@@ -11,6 +11,7 @@ The following JavaScript modules are currently available:
1111- MLE PL/SQL Types: [ mle-js-plsqltypes] [ mle-js-plsqltypes ]
1212- MLE Fetch API polyfill: [ mle-js-fetch] [ mle-js-fetch ]
1313- MLE Base64 Encoding: [ mle-encode-base64] [ mle-encode-base64 ]
14+ - MLE Encodings: [ mle-js-encodings] [ mle-js-encodings ]
1415
1516## Installation
1617You need an Oracle Database to make use of the JavaScript modules provided in the Oracle Database Multilingual Engine (MLE).
@@ -33,6 +34,8 @@ npm install mle-js-oracledb
3334npm install mle-js-bindings
3435npm install mle-js-plsqltypes
3536npm install mle-js-fetch
37+ npm install mle-encode-base64
38+ npm install mle-js-encodings
3639```
3740
3841## Documentation
@@ -91,33 +94,40 @@ The following table shows which version of module documentation and declarations
9194
9295| Oracle Database | Declarations | Documentation |
9396| ---------------- | ------------ | ------------- |
94- | 23ai
| [ [email protected] ] [ mle-js-types-234 ] for Oracle 23.4 <
br />
[ [email protected] ] [ mle-js-types-233 ] for Oracle 23.3 <
br />
[ [email protected] ] [ mle-js-types-232 ] for Oracle 23.2 - Free
| ** [ mle-js (23ai)
] [ mle-js ] ** <
br />
[ mle-js-oracledb (23ai)
] [ mle-js-oracledb ] <
br />
[ mle-js-bindings (23ai)
] [ mle-js-bindings ] <
br />
[ mle-js-plsqltypes (23ai)
] [ mle-js-plsqltypes ] <
br />
[ mle-js-fetch (23ai)
] [ mle-js-fetch ] <
br />
[ mle-encode-base64 (23ai)
] [ mle-encode-base64 ] | 97+ | 23ai
| [ mle-js@23.
5.0 ] [ mle-js-types-235 ] for Oracle 23.5 < br /> [ mle-js@23. 4.0
] [ mle-js-types-234 ] for Oracle 23.4 <
br />
[ [email protected] ] [ mle-js-types-233 ] for Oracle 23.3 <
br />
[ [email protected] ] [ mle-js-types-232 ] for Oracle 23.2 - Free
| ** [ mle-js (23ai)
] [ mle-js ] ** <
br />
[ mle-js-oracledb (23ai)
] [ mle-js-oracledb ] <
br />
[ mle-js-bindings (23ai)
] [ mle-js-bindings ] <
br />
[ mle-js-plsqltypes (23ai)
] [ mle-js-plsqltypes ] <
br />
[ mle-js-fetch (23ai)
] [ mle-js-fetch ] <
br />
[ mle-encode-base64 (23ai)
] [ mle-encode-base64 ] | 9598| 21c
| [ [email protected] ] [ mle-js-types-213 ] | [ mle-js-oracledb (21c)
] [ mle-js-oracledb-21c ] <
br />
[ mle-js-bindings (21c)
] [ mle-js-bindings-21c ] <
br />
[ mle-js-plsqltypes (21c)
] [ mle-js-plsqltypes-21c ] | 9699
97100## Examples
98101The following code snippet exemplifies the usage of some of these MLE modules combined.
99102For additional examples, please check the module documentation pages or have a look at our [ blog article] [ 2 ] .
100103
101104``` JavaScript
102- // imports
103- const oracledb = require (' mle-js-oracledb' );
104- const bindings = require (' mle-js-bindings' );
105- const plsqltypes = require (" mle-js-plsqltypes" );
106-
107- // Read a large number as an Oracle NUMBER from SQL and add another ORACLE NUMBER to it.
108- // mle-js-oracledb is used for reading from SQL and mle-js-plsqltypes is used to construct the second Oracle NUMBER.
109- const conn = oracledb .defaultConnection ();
110- const query = " SELECT 9007199254740992 AS n FROM dual" ;
111- const options = { fetchInfo: { N : { type: oracledb .ORACLE_NUMBER } } };
112- const queryResult = conn .execute (query, [], options);
113- const OracleNumber = plsqltypes .OracleNumber ;
114- const result = queryResult .rows [0 ][0 ].add (new OracleNumber (7 ));
115-
116- // Use mle-js-bindings to export the result of the computation.
117- // On the database side, this result could be retrieved using something like `dbms_mle.import_from_mle(ctx, 'result', result);`.
118- bindings .exportValue (" result" , result);
105+ async function run () {
106+ // import modules that do not have global symbols
107+ const bindings = await import (' mle-js-bindings' );
108+
109+ // Read a large number as an Oracle NUMBER from SQL and add another ORACLE NUMBER to it.
110+ // mle-js-oracledb (session) is used for reading from SQL and mle-js-plsqltypes (OracleNumber) is used to construct the second Oracle NUMBER.
111+ const query = " SELECT 9007199254740992 AS n FROM dual" ;
112+ const options = { fetchInfo: { N : { type: oracledb .ORACLE_NUMBER } } };
113+ const queryResult = session .execute (query, [], options);
114+ const result = queryResult .rows [0 ].N .add (new OracleNumber (7 ));
115+
116+ // print result to the console before exporting it
117+ console .log (result);
118+
119+ // Use mle-js-bindings to export the result of the computation.
120+ // On the database side, this result could be retrieved using something like `dbms_mle.import_from_mle(ctx, 'result', result);`.
121+ bindings .exportValue (" result" , result);
122+ }
123+ run ();
119124```
120125
126+ ## Building and deploying larger JavaScript projects
127+ If you plan to use database-side JavaScript at a larger scale, we highly
128+ recommend to read our blog post on [ Linting MLE JavaScript Modules in Continuous
129+ Integration Pipelines] [ 4 ] .
130+
121131## Help
122132If you have questions or change requests about MLE, please [ create a ticket] ( ./CONTRIBUTING.md ) or contact [ Oracle Support] ( https://support.oracle.com ) .
123133
@@ -144,10 +154,12 @@ Released under the Universal Permissive License v1.0 as shown at <https://oss.or
144154[ mle-js-oracledb-21c ] : https://oracle-samples.github.io/mle-modules/docs/mle-js-oracledb/21c " mle-js-oracledb 21c "
145155[ mle-js-bindings-21c ] : https://oracle-samples.github.io/mle-modules/docs/mle-js-bindings/21c " mle-js-bindings 21c "
146156[ mle-js-plsqltypes-21c ] : https://oracle-samples.github.io/mle-modules/docs/mle-js-plsqltypes/21c " mle-js-plsqltypes 21c "
157+ [ mle-js-types-235 ] :
https://www.npmjs.com/package/mle-js/v/23.5.0 " [email protected] " 147158[ mle-js-types-234 ] :
https://www.npmjs.com/package/mle-js/v/23.4.0 " [email protected] " 148159[ mle-js-types-233 ] :
https://www.npmjs.com/package/mle-js/v/23.3.0 " [email protected] " 149160[ mle-js-types-232 ] :
https://www.npmjs.com/package/mle-js/v/23.2.0 " [email protected] " 150161[ mle-js-types-213 ] :
https://www.npmjs.com/package/mle-js/v/21.3.1 " [email protected] " 151162[ 1 ] : https://blogs.oracle.com/developers/post/introduction-javascript-oracle-database-23c-free-developer-release " Introduction to JavaScript in Oracle Database 23c Free - Developer Release "
152163[ 2 ] : https://blogs.oracle.com/apex/post/mle-and-the-future-of-server-side-programming-in-oracle-apex " MLE and the Future of Server-Side Programming in Oracle APEX "
153164[ 3 ] : https://docs.oracle.com/en/database/oracle/oracle-database " Oracle Database "
165+ [ 4 ] : https://blogs.oracle.com/developers/post/linting-mle-javascript-modules-in-continuous-integration-pipelines " JavaScript CI/CD blog "
0 commit comments