JavaScript
Multilingual Engine JavaScript Modules and Environments
Multilingual Engine (MLE) Modules and Environments allow JavaScript code to persist and be managed in the database. Call specifications provide a means to call JavaScript functions from an MLE module anywhere you can call PL/SQL functions.
The introduction of JavaScript Modules and Environments as schema objects in Oracle AI Database allows developers to follow established and well-known workflows used in client-side JavaScript development. Complex projects can be broken down into smaller, more manageable pieces worked on independently by team members.
Multilingual Engine Module Calls
Multilingual Engine (MLE) Module Calls allow developers to invoke JavaScript functions stored in modules from SQL and PL/SQL. Call Specifications written in PL/SQL link JavaScript to PL/SQL code units.
Thanks to Module Calls, developers can use JavaScript functions anywhere PL/SQL functions are called.
Multilingual Engine Post-Execution Debugging
Oracle Multilingual Engine (MLE) allows developers to debug their JavaScript code by conveniently and efficiently collecting runtime state while the program is being processed, a method referred to as post-execution debugging. After the code has finished running, the collected data can be used to analyze program behavior, discover, and fix bugs.
Post-execution debugging offers a convenient way to extract runtime state information from a JavaScript code unit at runtime without having to change the observed code.
Multilingual Engine JavaScript SODA API
Simple Oracle Document Access (SODA) is a set of NoSQL-style APIs that let you create and store collections of documents (in particular JSON) in Oracle AI Database, retrieve them, and query them, without needing to know SQL or how the documents are stored in the database. With the introduction of MLE, JavaScript support for SODA documents exists for client-side and server-side development.
Supporting the Simple Oracle Document Access (SODA) API in JavaScript gives developers a choice between using JSON in a relational or No-SQL way, simplifying the development process and improving the portability of code.
Multilingual Engine JavaScript Support for JSON Data Type
Support for JavaScript Object Notation (JSON) is an integral part of Oracle AI Database. Oracle supports JSON natively with relational database features, including transactions, indexing, declarative querying, and views. A rich set of SQL functions is available to manipulate JSON in a relational model. Oracle Multilingual Engine (MLE) fully supports JSON: both dynamic MLE as well as MLE Module Calls support interactions with the JSON data type.
JSON and JavaScript objects are closely related, forming a natural match in such a way that makes working with JSON very easy with JavaScript code.
Compile-Time Syntax Checking for JavaScript Procedures and Functions
Syntax checks are now run at compile time on JavaScript functions executed using inline call specifications, providing valuable analysis of your code before runtime.
When used in combination with the linting tool of your choice, compile-time syntax checks can help increase confidence in the readiness of your code by providing an extra step of code analysis. This compile-time support matches the checks already available when creating MLE modules.
EXECUTE Privilege on JAVASCRIPT Not Required Anymore
The EXECUTE ON JAVASCRIPT
privilege is no longer required in order to run JavaScript code from your user account.
You can now create Multilingual Engine (MLE) modules and execute inline call specifications to publish JavaScript functions without the extra step of granting the EXECUTE ON JAVASCRIPT
privilege. This provides a more streamlined introductory experience to using MLE.
Foreign Function Interface for JavaScript to Call PL/SQL Code Units
The Foreign Function Interface (FFI) allows JavaScript developers to use a more familiar syntax to call code units written in PL/SQL.
Rather than using PL/SQL blocks, it is possible to use native JavaScript constructs to interact with most code written in PL/SQL. Using the FFI provides JavaScript developers with a much improved experience by streamlining the process of integrating PL/SQL code into JavaScript functions.
Restricted Execution Contexts for In-Database JavaScript
The PURE
option can be specified on Multilingual Engine (MLE) environments and JavaScript inline call specifications to create restricted JavaScript contexts in which interaction with database functionality is not possible.
Creating restricted JavaScript execution contexts using the PURE
option gives you a convenient way to limit capabilities of JavaScript code running in the database. A JavaScript program executing in a restricted context is guaranteed not to modify database tables or use PL/SQL packages, regardless of database privileges currently in effect. Common data processing use cases with user-defined functions require only computations on function inputs. In these scenarios, restricted contexts provide a safety net, prohibiting unwanted database modifications—for example, when using third-party or open-source JavaScript libraries.
In the context of AI Vector Search, JavaScript functions can be used as user-defined vector distance metrics when creating an HNSW index. Only JavaScript functions marked with the PURE
option are allowed on HNSW indexes.
SQL Objects and Collections in MLE JavaScript
Objects and collection data types are now supported with the Multilingual Engine (MLE). These types can now be used in call specifications as IN
, OUT
, and IN OUT
function arguments as well as RETURN
types.
The support of user-defined types and collections extends the available use cases for MLE in your applications.
Sparse Vector Support in MLE JavaScript
You can specify a vector's storage format as either SPARSE
or DENSE
. Sparse vectors are vectors that typically have a large number of dimensions but with very few non-zero dimension values.
Apart from potential performance improvements, sparse vectors can use considerably less space than a corresponding dense vector with very few non-zero values. Users of In-Database JavaScript benefit from sparse vector support.