Skip to main content

Oracle Reference

Authentication options and data type handling for Oracle connections.

Authentication

VariableExampleDescription
DATACONTRACT_ORACLE_USERNAMEsystemUsername
DATACONTRACT_ORACLE_PASSWORD0x162e53Password
DATACONTRACT_ORACLE_CLIENT_DIRC:\oracle\clientPath to an Oracle Instant Client installation (required for thick mode)

host, port (default 1521), service_name, and schema come from the contract's servers block.

Data types

Importing

datacontract import sql --dialect oracle maps DDL types as follows; the normalized SQL type is kept as physicalType.

Oracle typelogicalType
VARCHAR2, NVARCHAR2, CHAR, NCHARstring (maxLength for varchar/char)
CLOB, NCLOBstring
NUMBERnumber (precision/scale as custom properties)
BINARY_FLOAT, BINARY_DOUBLE, FLOATnumber
DATEdate
TIMESTAMP, TIMESTAMP WITH (LOCAL) TIME ZONEtimestamp
RAW, BLOB, BFILEstring (format binary)
XMLTYPE, ROWID, INTERVAL types(unset)physicalType is still written

Testing

Oracle supports native type introspection: the declared physicalType is checked against ALL_TAB_COLUMNS. Length is reconstructed for character and RAW types, precision/scale for NUMBER; parameters are only enforced when the contract declares them. Types that sqlglot can't parse (ROWID, INTERVAL) are compared by name. A physicalType that can't be interpreted falls back to the logical type category comparison.

Logical type mapping

When no physicalType is declared, the CLI derives the native type from the logicalType — for example in datacontract export sql and the dbt exports. This table is generated from the converter in the CLI's code:

logicalTypeOracle type
stringNVARCHAR2(2000)
integerNUMBER
numberNUMBER
booleanCHAR(1)
dateDATE
timestampTIMESTAMP(6) WITH TIME ZONE
timeDATE
objectCLOB
arrayCLOB