Oracle - Data Types¶
This section shows equivalents between data types in Oracle and Snowflake, as well as some notes on arithmetic differences.
| Oracle | Snowflake |
|---|---|
| ANSI Data Types | *Go to the link to get more information |
| BFILE | VARCHAR |
| BINARY_DOUBLE | FLOAT |
| BINARY_FLOAT | FLOAT |
| BLOB | BINARY |
| CHAR (N) | CHAR (N) |
| CLOB | VARCHAR |
| DATE | TIMESTAMP |
| FLOAT | FLOAT |
| INTERVAL YEAR TO MONTH | VARCHAR(20) |
| INTERVAL DAY TO SECOND | VARCHAR(20) |
| JSON | VARIANT |
| LONG | VARCHAR |
| LONG RAW | BINARY |
| NCHAR (N) | NCHAR (N) |
| NCLOB | VARCHAR |
| NUMBER(p, s) | NUMBER(p, s) |
| NVARCHAR2 (N) | VARCHAR (N) |
| RAW | BINARY |
| ROWID | VARCHAR(18) |
| VARCHAR2 (N) | VARCHAR (N) |
| SDO_GOMETRY | Currently not supported |
| SDO_TOPO___GEOMETRY | *to be defined |
| SDO_GEORASTER | *to be defined |
| SYS.ANYDATA | VARIANT |
| SYS.ANYDATASET | *to be defined |
| SYS.ANYTYPE | *to be defined |
| TIMESTAMP | TIMESTAMP |
| TIMESTAMP WITH TIME ZONE | TIMESTAMP_TZ |
| TIMESTAMP WITH LOCAL TIME ZONE | TIMESTAMP_LTZ |
| URITYPE | *to be defined |
| UROWID | VARCHAR(18) |
| VARCHAR | VARCHAR |
| VARCHAR2 | VARCHAR |
| XMLType | VARIANT |
Notes on arithmetic operations¶
Please be aware that every operation performed on numerical datatypes is internally stored as a Number. Furthermore, depending on the operation performed it is possible to incur an error related to how intermediate values are stored within Snowflake, for more information please check this post on Snowflake’s post on intermediate numbers in Snowflake.
ANSI Data Types¶
Description¶
SQL statements that create tables and clusters can also use ANSI data types and data types from the IBM products SQL/DS and DB2. Oracle recognizes the ANSI or IBM data type name that differs from the Oracle Database data type name. It converts the data type to the equivalent Oracle data type, records the Oracle data type as the name of the column data type, and stores the column data in the Oracle data type based on the conversions shown in the tables that follow. (Oracle Language Reference ANSI, DB2, and SQL/DS Data Types).
When creating a new table, Oracle and Snowflake handle some data types as synonyms and aliases and transform them into the default data type. As shown in the next table:
| ANSI | ORACLE | SNOWFLAKE |
|---|---|---|
| CHARACTER (n) | CHAR (n) | VARCHAR |
| CHAR (n) | CHAR (n) | VARCHAR |
| CHARACTER VARYING (n) | VARCHAR2 (n) | VARCHAR |
| CHAR VARYING (n) | VARCHAR2 (n) | VARCHAR |
| NATIONAL CHARACTER (n) | NCHAR (n) | VARCHAR* |
| NATIONAL CHAR (n) | NCHAR (n) | VARCHAR* |
| NCHAR (n) | NCHAR (n) | VARCHAR |
| NATIONAL CHARACTER VARYING (n) | NVARCHAR2 (n) | VARCHAR* |
| NATIONAL CHAR VARYING (n) | NVARCHAR2 (n) | VARCHAR* |
| NCHAR VARYING (n) | NVARCHAR2 (n) | NUMBER (p, s) |
| NUMERIC [(p, s)] | NUMBER (p, s) | NUMBER (p, s) |
| DECIMAL [(p, s)] | NUMBER (p, s) | NUMBER (38) |
| INTEGER | NUMBER (38) | NUMBER (38) |
| INT | NUMBER (38) | NUMBER (38) |
| SMALLINT | NUMBER (38) | NUMBER (38) |
| FLOAT | FLOAT (126) | DOUBLE |
| DOUBLE PRECISION | FLOAT (126) | DOUBLE |
| REAL | FLOAT (63) | DOUBLE |
To get more information about the translation specification of the Oracle data types, go to Oracle Built-in Data Types.
Note
VARCHAR*: Almost all the ANSI datatypes compile in Snowflake, but those marked with an asterisk, are manually converted to VARCHAR.
Known Issues¶
No issues were found.
Related EWIs¶
EWIs related to these data types are specified in the transformation of the Oracle Built-in data types.
Data Type Customization¶
Data Type Customization is enabled to specify rules for data type transformation based on data type origin and column name. This feature allows you to personalize data type conversions and set precision values more accurately during migration.
For complete documentation on configuring data type customization, including JSON structure, configuration options, and priority rules, see Data type mappings.
Data type mappings¶
Default mappings for data type conversions are defined. However, you can point to a JSON file to customize specific data type mappings.
Customize data types: You can upload a JSON file to define specific data type transformation rules. This feature allows you to customize how data types are converted during migration.
Supported transformations include:
NUMBERto customNUMBERwith specific precision and scaleNUMBERtoDECFLOATfor preserving exact decimal precision
When you upload a data type customization file:
- Your transformation rules are applied during conversion
- Numeric literals in
INSERTstatements targeting customized columns are automatically cast to the appropriate type - A TypeMappings Report is generated showing all data type transformations applied
JSON Structure:
The JSON file supports three ways to specify data type changes:
| Method | Scope | Use Case |
|---|---|---|
projectTypeChanges.types | Global | Transform all occurrences of a specific data type |
projectTypeChanges.columns | Global | Transform columns matching a name pattern (case-insensitive substring match) |
specificTableTypeChanges.tables | Table-specific | Transform specific columns in specific tables |
Warning
Use column name patterns carefully. The projectTypeChanges.columns rules only apply to columns with NUMBER data types, but they match by name pattern without considering the precision or scale of the original NUMBER type. This means a pattern like "MONTH" will transform all matching NUMBER columns to the target type, regardless of their original precision (e.g., NUMBER(10,0), NUMBER(38,18), or NUMBER without precision). Always review the TypeMappings Report after conversion to verify that the transformations were applied correctly.
Priority order: When multiple rules apply to the same column, the following priorities are used from highest to lowest:
specificTableTypeChanges(most specific)projectTypeChanges.columns(name pattern)projectTypeChanges.types(global type mapping)
Example JSON configuration:
Download template: Copy and save the JSON structure above as your starting point.
Example transformation:
Given the following Oracle input code:
Oracle¶
And a JSON customization file with:
"NUMBER": "NUMBER(11, 2)"inprojectTypeChanges.types"NUMBER(10, 0)": "NUMBER(18, 0)"inprojectTypeChanges.types"MONTH"pattern targetingNUMBER(2,0)inprojectTypeChanges.columnsSALARYcolumn targetingNUMBER(15, 2)inspecificTableTypeChangesfor EMPLOYEES table
The output will be:
Snowflake¶
| Column | Original Type | Transformed To | Rule Applied |
|---|---|---|---|
| employee_ID | NUMBER | NUMBER(11, 2) | projectTypeChanges.types |
| manager_YEAR | NUMBER(10, 0) | NUMBER(18, 0) | projectTypeChanges.types |
| manager_MONTH | NUMBER(10, 0) | NUMBER(2, 0) | projectTypeChanges.columns (MONTH pattern) |
| salary | NUMBER(12, 2) | NUMBER(15, 2) | specificTableTypeChanges (highest priority) |
NUMBER to DECFLOAT Transformation¶
Transforming Oracle NUMBER columns to Snowflake DECFLOAT data type is supported. This is useful when you need to preserve the exact decimal precision of numeric values during migration.
When a NUMBER column is configured to be transformed to DECFLOAT:
- The column data type in
CREATE TABLEstatements is transformed toDECFLOAT - Numeric literals in
INSERTstatements that targetDECFLOATcolumns are automatically wrapped withCAST(... AS DECFLOAT)to ensure proper data type handling - Column references in
INSERT ... SELECTstatements are also cast appropriately
Example¶
Oracle¶
Snowflake (with DECFLOAT customization for price column)¶
Note
The TypeMappings report (TypeMappings.csv) provides a detailed view of all data type transformations applied during conversion. See TypeMappings Report for more information.