About Dynamic JavaScript Execution

Developers can run JavaScript dynamically either inline or by loading files via DBMS_MLE. Dynamic MLE execution provides an additional method for using JavaScript to interact with the Oracle Database, as an alternative to using MLE modules.

The DBMS_MLE package allows users to execute JavaScript code inside the Oracle Database and seamlessly exchange data between PL/SQL and JavaScript. The JavaScript code itself can execute PL/SQL through built-in JavaScript modules. JavaScript data types are automatically mapped to Oracle Database data types and vice versa.

Developers can provide JavaScript code either as the value of a VARCHAR2 variable or, in case of larger amounts of code, as a Character Large Object (CLOB). The JavaScript code is passed to the DBMS_MLE package where it is evaluated and executed.

Considering that DBMS_MLE is a PL/SQL package, there is mix of JavaScript and PL/SQL when dynamically executing code using DBMS_MLE, for example, in the following cases:
  • Setup tasks such as providing the JavaScript code require an interaction with the PL/SQL layer.

  • JavaScript code is executed by calling a function in DBMS_MLE.

  • After JavaScript code completes execution, any errors that have been encountered are passed back to PL/SQL.