5 Overview of Importing MLE JavaScript Modules

One of the key benefits of MLE is the ability to store modules of JavaScript code in the Oracle Database. The availability of modules supports self-contained and reusable code, key to developing successful software projects.

MLE modules interact with each other through imports and exports. Specifically, if a module wants to use a functionality provided by another module, the source module must be exported and then imported into the calling module's scope.

Due to a difference in architecture, module imports behave slightly differently in the Oracle Database when compared to other development environments. For example, JavaScript source code used with Node.js is stored in a specific directory structure on disk. Alternatively, MLE modules are stored together with the database, rather than in a file system, so must be referenced in a different manner.

There are two options available for module imports in MLE:
  • Importing module functionality into another module
  • Importing module functionality into a code snippet to be executed via dynamic MLE (using the DBMS_MLE PL/SQL package)

Note:

MLE supports a pure JavaScript implementation. Module exports and imports are facilitated as ECMAScript modules using the export and import keywords. Other JavaScript modularization technologies such as CommonJS and Asynchronous Module Definition (AMD) are not available.

See Also:

MLE JavaScript Modules and Environments for more information on MLE modules

Topics