SlideShare a Scribd company logo
1 of 16
It's Time to Get Ready for the Power
of PL/SQL and JavaScript Combined
Rodrigo Mesquita
March 30th, 2023
About Rodrigo
• Senior Oracle Developer at QV Systems - UK leading software
provider of asset back finance such as Auto Finance.
• 20 years of Oracle Experience
• Oracle ACE Pro
• UKOUG - 2018 Best New UK Speaker
• Twitter: @mesquitarod
apexblog.dev
The Multilingual Engine (MLE)
• Available from Oracle 21c and APEX 20.2
• Oracle Database provides the DBMS_MLE PL/SQL package to evaluate
JavaScript code within a database session
• Powered by GraalVM Multilingual Engine: Javascript could be just the
beginning.
apex.server.process
Client Side Server Side
Javascript PL/SQL
Oracle Database
with APEX
MLE
Client Side Server Side
PL/SQL & Javascript
Oracle Database
with APEX
and MLE
MLE with APEX
• Processes
• Computations
• Validation
• Execute Server-side Code dynamic action
• SQL Commands
• Region Source
MLE
Non-MLE
Page
Submit
PL/SQL
JavaScript
PL/SQL
JavaScript
PL/SQL
JavaScript
PL/SQL
Before After
apex.env - allow us to interact with page items
apex.conn.execute - execute DML or PL/SQL
JavaScript as a Server-Side Language in Oracle APEX by Stephan Dobre
DECLARE
ctx dbms_mle.context_handle_t;
user_code clob := q'~
console.log('Hello World!');
~';
BEGIN
ctx := dbms_mle.create_context();
dbms_mle.eval(ctx, 'JAVASCRIPT', user_code);
dbms_mle.drop_context(ctx);
EXCEPTION
WHEN others THEN
dbms_mle.drop_context(ctx);
RAISE;
END;
DECLARE
ctx dbms_mle.context_handle_t;
result varchar2(100);
user_code clob := q'~
let bindings = require('mle-js-bindings');
let val = bindings.importValue('value');
bindings.exportValue('response', val+' is awesome');
~';
BEGIN
ctx := dbms_mle.create_context();
dbms_mle.export_to_mle(ctx, 'value', 'APEX');
dbms_mle.eval(ctx, 'JAVASCRIPT', user_code);
dbms_mle.import_from_mle(ctx, 'response', result);
dbms_mle.drop_context(ctx);
dbms_output.put_line(result);
EXCEPTION
WHEN others THEN
dbms_mle.drop_context(ctx);
RAISE;
END;
/
DECLARE
ctx dbms_mle.context_handle_t;
result varchar2(100);
user_code clob := q'~
let bindings = require('mle-js-bindings');
const oracledb = require('mle-js-oracledb');
const conn = oracledb.defaultConnection();
let val = bindings.importValue('value');
const code = "update customers set full_name = 'Rodrigo Mesquita' where customer_id = "+val;
conn.execute(code);
~';
BEGIN
ctx := dbms_mle.create_context();
dbms_mle.export_to_mle(ctx, 'value', 1);
dbms_mle.eval(ctx, 'JAVASCRIPT', user_code);
dbms_mle.drop_context(ctx);
EXCEPTION
WHEN others THEN
dbms_mle.drop_context(ctx);
RAISE;
END;
DECLARE
ctx DBMS_MLE.context_handle_t := DBMS_MLE.create_context();
user_code clob := q'~
const oracledb = require('mle-js-oracledb');
const OracleNumber = require('mle-js-plsqltypes').OracleClob;
let bindings = require('mle-js-bindings');
const conn = oracledb.defaultConnection();
let val = bindings.importValue('value');
const query = "SELECT full_name AS name FROM customers where customer_id = "+val;
const options = { fetchInfo: { name: { type: oracledb.ORACLE_CLOB } } };
const result = conn.execute(query, [], options);
console.log(result.rows[0][0]);
~';
BEGIN
DBMS_MLE.export_to_mle(ctx, 'value', 1);
DBMS_MLE.eval(ctx, 'JAVASCRIPT', user_code);
DBMS_MLE.drop_context(ctx);
EXCEPTION
WHEN others THEN
DBMS_MLE.drop_context(ctx);
RAISE;
END;
API USER
CLIENT SECRET
STRING =
API User +
Client Secret +
timestamp
Automation DB Procedure
It's Time to Get Ready for the Power  of PL/SQL and JavaScript Combined

More Related Content

Similar to It's Time to Get Ready for the Power of PL/SQL and JavaScript Combined

Php classes in mumbai
Php classes in mumbaiPhp classes in mumbai
Php classes in mumbaiaadi Surve
 
KSQL - Stream Processing simplified!
KSQL - Stream Processing simplified!KSQL - Stream Processing simplified!
KSQL - Stream Processing simplified!Guido Schmutz
 
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_wormDefcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_wormguest785f78
 
Denver SQL Saturday The Next Frontier
Denver SQL Saturday The Next FrontierDenver SQL Saturday The Next Frontier
Denver SQL Saturday The Next FrontierKellyn Pot'Vin-Gorman
 
Fast Web Applications Development with Ruby on Rails on Oracle
Fast Web Applications Development with Ruby on Rails on OracleFast Web Applications Development with Ruby on Rails on Oracle
Fast Web Applications Development with Ruby on Rails on OracleRaimonds Simanovskis
 
Useful PL/SQL Supplied Packages
Useful PL/SQL Supplied PackagesUseful PL/SQL Supplied Packages
Useful PL/SQL Supplied PackagesMaria Colgan
 
Php & my sql - how do pdo, mysq-li, and x devapi do what they do
Php & my sql  - how do pdo, mysq-li, and x devapi do what they doPhp & my sql  - how do pdo, mysq-li, and x devapi do what they do
Php & my sql - how do pdo, mysq-li, and x devapi do what they doDave Stokes
 
Vertically Scaled Design Patters
Vertically Scaled Design PattersVertically Scaled Design Patters
Vertically Scaled Design PattersJeff Malnick
 
SproutCore and the Future of Web Apps
SproutCore and the Future of Web AppsSproutCore and the Future of Web Apps
SproutCore and the Future of Web AppsMike Subelsky
 
20151010 my sq-landjavav2a
20151010 my sq-landjavav2a20151010 my sq-landjavav2a
20151010 my sq-landjavav2aIvan Ma
 
Slow Database in your PHP stack? Don't blame the DBA!
Slow Database in your PHP stack? Don't blame the DBA!Slow Database in your PHP stack? Don't blame the DBA!
Slow Database in your PHP stack? Don't blame the DBA!Harald Zeitlhofer
 
Migrating Legacy Data (Ruby Midwest)
Migrating Legacy Data (Ruby Midwest)Migrating Legacy Data (Ruby Midwest)
Migrating Legacy Data (Ruby Midwest)Patrick Crowley
 
"ClojureScript journey: from little script, to CLI program, to AWS Lambda fun...
"ClojureScript journey: from little script, to CLI program, to AWS Lambda fun..."ClojureScript journey: from little script, to CLI program, to AWS Lambda fun...
"ClojureScript journey: from little script, to CLI program, to AWS Lambda fun...Julia Cherniak
 

Similar to It's Time to Get Ready for the Power of PL/SQL and JavaScript Combined (20)

Copy Data Management for the DBA
Copy Data Management for the DBACopy Data Management for the DBA
Copy Data Management for the DBA
 
Php classes in mumbai
Php classes in mumbaiPhp classes in mumbai
Php classes in mumbai
 
KSQL - Stream Processing simplified!
KSQL - Stream Processing simplified!KSQL - Stream Processing simplified!
KSQL - Stream Processing simplified!
 
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_wormDefcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
 
Denver SQL Saturday The Next Frontier
Denver SQL Saturday The Next FrontierDenver SQL Saturday The Next Frontier
Denver SQL Saturday The Next Frontier
 
Fast Web Applications Development with Ruby on Rails on Oracle
Fast Web Applications Development with Ruby on Rails on OracleFast Web Applications Development with Ruby on Rails on Oracle
Fast Web Applications Development with Ruby on Rails on Oracle
 
Useful PL/SQL Supplied Packages
Useful PL/SQL Supplied PackagesUseful PL/SQL Supplied Packages
Useful PL/SQL Supplied Packages
 
Php & my sql - how do pdo, mysq-li, and x devapi do what they do
Php & my sql  - how do pdo, mysq-li, and x devapi do what they doPhp & my sql  - how do pdo, mysq-li, and x devapi do what they do
Php & my sql - how do pdo, mysq-li, and x devapi do what they do
 
Vertically Scaled Design Patters
Vertically Scaled Design PattersVertically Scaled Design Patters
Vertically Scaled Design Patters
 
Node.js - As a networking tool
Node.js - As a networking toolNode.js - As a networking tool
Node.js - As a networking tool
 
Intro to Laravel 4
Intro to Laravel 4Intro to Laravel 4
Intro to Laravel 4
 
SproutCore and the Future of Web Apps
SproutCore and the Future of Web AppsSproutCore and the Future of Web Apps
SproutCore and the Future of Web Apps
 
Jdbc
JdbcJdbc
Jdbc
 
20151010 my sq-landjavav2a
20151010 my sq-landjavav2a20151010 my sq-landjavav2a
20151010 my sq-landjavav2a
 
Slow Database in your PHP stack? Don't blame the DBA!
Slow Database in your PHP stack? Don't blame the DBA!Slow Database in your PHP stack? Don't blame the DBA!
Slow Database in your PHP stack? Don't blame the DBA!
 
Wider than rails
Wider than railsWider than rails
Wider than rails
 
Migrating Legacy Data (Ruby Midwest)
Migrating Legacy Data (Ruby Midwest)Migrating Legacy Data (Ruby Midwest)
Migrating Legacy Data (Ruby Midwest)
 
"ClojureScript journey: from little script, to CLI program, to AWS Lambda fun...
"ClojureScript journey: from little script, to CLI program, to AWS Lambda fun..."ClojureScript journey: from little script, to CLI program, to AWS Lambda fun...
"ClojureScript journey: from little script, to CLI program, to AWS Lambda fun...
 
Jdbc
JdbcJdbc
Jdbc
 
Java JDBC
Java JDBCJava JDBC
Java JDBC
 

Recently uploaded

Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 

Recently uploaded (20)

Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 

It's Time to Get Ready for the Power of PL/SQL and JavaScript Combined

  • 1. It's Time to Get Ready for the Power of PL/SQL and JavaScript Combined Rodrigo Mesquita March 30th, 2023
  • 2. About Rodrigo • Senior Oracle Developer at QV Systems - UK leading software provider of asset back finance such as Auto Finance. • 20 years of Oracle Experience • Oracle ACE Pro • UKOUG - 2018 Best New UK Speaker • Twitter: @mesquitarod
  • 4. The Multilingual Engine (MLE) • Available from Oracle 21c and APEX 20.2 • Oracle Database provides the DBMS_MLE PL/SQL package to evaluate JavaScript code within a database session • Powered by GraalVM Multilingual Engine: Javascript could be just the beginning.
  • 5. apex.server.process Client Side Server Side Javascript PL/SQL Oracle Database with APEX
  • 6. MLE Client Side Server Side PL/SQL & Javascript Oracle Database with APEX and MLE
  • 7. MLE with APEX • Processes • Computations • Validation • Execute Server-side Code dynamic action • SQL Commands • Region Source
  • 9. apex.env - allow us to interact with page items apex.conn.execute - execute DML or PL/SQL JavaScript as a Server-Side Language in Oracle APEX by Stephan Dobre
  • 10. DECLARE ctx dbms_mle.context_handle_t; user_code clob := q'~ console.log('Hello World!'); ~'; BEGIN ctx := dbms_mle.create_context(); dbms_mle.eval(ctx, 'JAVASCRIPT', user_code); dbms_mle.drop_context(ctx); EXCEPTION WHEN others THEN dbms_mle.drop_context(ctx); RAISE; END;
  • 11. DECLARE ctx dbms_mle.context_handle_t; result varchar2(100); user_code clob := q'~ let bindings = require('mle-js-bindings'); let val = bindings.importValue('value'); bindings.exportValue('response', val+' is awesome'); ~'; BEGIN ctx := dbms_mle.create_context(); dbms_mle.export_to_mle(ctx, 'value', 'APEX'); dbms_mle.eval(ctx, 'JAVASCRIPT', user_code); dbms_mle.import_from_mle(ctx, 'response', result); dbms_mle.drop_context(ctx); dbms_output.put_line(result); EXCEPTION WHEN others THEN dbms_mle.drop_context(ctx); RAISE; END; /
  • 12. DECLARE ctx dbms_mle.context_handle_t; result varchar2(100); user_code clob := q'~ let bindings = require('mle-js-bindings'); const oracledb = require('mle-js-oracledb'); const conn = oracledb.defaultConnection(); let val = bindings.importValue('value'); const code = "update customers set full_name = 'Rodrigo Mesquita' where customer_id = "+val; conn.execute(code); ~'; BEGIN ctx := dbms_mle.create_context(); dbms_mle.export_to_mle(ctx, 'value', 1); dbms_mle.eval(ctx, 'JAVASCRIPT', user_code); dbms_mle.drop_context(ctx); EXCEPTION WHEN others THEN dbms_mle.drop_context(ctx); RAISE; END;
  • 13. DECLARE ctx DBMS_MLE.context_handle_t := DBMS_MLE.create_context(); user_code clob := q'~ const oracledb = require('mle-js-oracledb'); const OracleNumber = require('mle-js-plsqltypes').OracleClob; let bindings = require('mle-js-bindings'); const conn = oracledb.defaultConnection(); let val = bindings.importValue('value'); const query = "SELECT full_name AS name FROM customers where customer_id = "+val; const options = { fetchInfo: { name: { type: oracledb.ORACLE_CLOB } } }; const result = conn.execute(query, [], options); console.log(result.rows[0][0]); ~'; BEGIN DBMS_MLE.export_to_mle(ctx, 'value', 1); DBMS_MLE.eval(ctx, 'JAVASCRIPT', user_code); DBMS_MLE.drop_context(ctx); EXCEPTION WHEN others THEN DBMS_MLE.drop_context(ctx); RAISE; END;
  • 14. API USER CLIENT SECRET STRING = API User + Client Secret + timestamp