A MLE Type Conversions
Supported conversions between JavaScript and PL/SQL, SQL, and JSON data types.
JavaScript target types include both native JavaScript types as well as SQL wrapper types. Supported SQL types are converted to the analogous JavaScript type by default where such a natural counterpart exists. If a conversion is attempted and there is no corresponding JavaScript type, conversion to a native JavaScript type is not supported and values are instead converted to the corresponding SQL wrapper type by default.
Note:
MLE does not provide functionality to prevent information loss that might occur between conversions from a customized database character representation to the built-in string representation of JavaScript (UTF-16).See Also:
-
Server-Side JavaScript API Documentation for information about using
mle-js-bindingsto change the default mappings when exchanging values between PL/SQL and JavaScript - Server-Side JavaScript API
Documentation for information on how to use
mle-js-plsqltypesto create SQL wrapper types, such asOracleNumber - Server-Side JavaScript API
Documentation for information on using
mle-js-oracledbto override the default conversions (as seen in Table A-1) when fetching column values from aSELECTstatement
Date Conversions
JavaScript Date represents an instant (i.e., a single moment in
time). Conversions can occur between the instant type Date and
PL/SQL types DATE and TIMESTAMP that do not have
time zone information. Conversions between instants on the JavaScript side and
DATE and TIMESTAMP on the other side are
handled as follows:
-
When converting a
Dateto aTIMESTAMPorDATE, the instant is converted to a timezone-aware datatime value in the current session time zone. The local datatime portion of this value is stored in the targetDATEorTIMESTAMPvalue. -
To convert a
TIMESTAMPorDATEto a timezone-awareDate, the source datetime value is interpreted to be in the session time zone and is converted into an instant according to the session time zone.
Table A-1 Supported Mappings from SQL and PL/SQL Types to JavaScript Types
| SQL Type | JavaScript Types (Bold Font Signifies Default) |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
any (object, array, null)Foot 3 |
Footnote 1 Note that
BINARY_INTEGER is a PL/SQL type and not
supported in SQL. MLE
only supports BINARY_INTEGER on PL/SQL
interfaces.
Footnote 2 Although not technically a type, MLE converts a SQL
NULL value into a JavaScript
null value and vice versa. This is so that
JavaScript can indicate to the database that a value passed into
the database is absent (for example, the return value of a
function or an IN bind in a SQL
statement).
Footnote 3 See MLE JavaScript Support for JSON for details
Table A-2 Supported Mappings from JavaScript Types to SQL Types
| JavaScript Type | SQL Type |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
BINARY_INTEGER |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UintArray |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
objectFoot 4 |
JSONFoot 5 |
Footnote 4 JavaScript objects and arrays that do not match one of the classes listed above
Footnote 5 See MLE JavaScript Support for JSON for details
- MLE JavaScript Support for JSON
Supported conversions between JavaScript and the JSON data type. - MLE JavaScript Support for the VECTOR Data Type
Oracle Multilingual Engine (MLE) supports conversions between JavaScript TypedArrays and SQL vectors with formatsINT8,FLOAT32, andFLOAT64. Data exchanges between JavaScript and theVECTORdata type are supported by the MLE JavaScript SQL driver, MLE call specifications, and MLE JavaScript bindings.