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:

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:

Supported Mappings from SQL and PL/SQL Types to JavaScript Types

SQL Type JavaScript Types (Bold Font Signifies Default)
NUMBER number

OracleNumber
BINARY_FLOAT number
BINARY_DOUBLE number
BINARY_INTEGER1 number
BOOLEAN boolean
VARCHAR2 string
NVARCHAR2 string
CHAR string
NCHAR string
CLOB OracleCLOB

string
NCLOB OracleCLOB

string
BLOB OracleBLOB

Uint8Array (TypedArray)
RAW Uint8Array (TypedArray)
DATE Date

OracleDate
TIMESTAMP Date

OracleTimestamp
TIMESTAMP WITH TIME ZONE Date

OracleTimestampTZ
TIMESTAMP WITH LOCAL TIME ZONE Date

OracleTimestampTZ
INTERVAL YEAR TO MONTH OracleIntervalYearToMonth
INTERVAL DAY TO SECOND OracleIntervalDayToSecond
NULL2 null
JSON any (object, array, null)3

Supported Mappings from JavaScript Types to SQL Types

JavaScript Type SQL Type
number

boolean

OracleNumber
NUMBER
number BINARY_FLOAT
number BINARY_DOUBLE
number

boolean
BINARY_INTEGER
number

OracleNumber

boolean
BOOLEAN
string VARCHAR2
string CHAR
string NCHAR
string NVARCHAR2
string

OracleCLOB
CLOB
string

OracleCLOB
NCLOB
string UROWID
Uint8Array

OracleBlob
BLOB
UintArray RAW
Date

OracleDate
DATE
Date

OracleTimestamp
TIMESTAMP
Date

OracleTimestampTZ
TIMESTAMP WITH (LOCAL) TIME ZONE
OracleIntervalYearToMonth INTERVAL YEAR TO MONTH
OracleIntervalDayToSecond INTERVAL DAY TO SECOND
null NULL (any supported SQL type)
number

string

boolean

null

undefined

Date

Uint8Array

OracleNumber

OracleDate

OracleTimestamp

OracleTimestampTZ

OracleIntervalYearToMonth

OracleIntervalDayToSecond

object4
JSON5
  1. Note that BINARY_INTEGER is a PL/SQL type and not supported in SQL. MLE only supports BINARY_INTEGER on PL/SQL interfaces. 

  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). 

  3. See MLE JavaScript Support for JSON for details. 

  4. JavaScript objects and arrays that do not match one of the classes listed in the table. 

  5. See MLE JavaScript Support for JSON for details.