Data type mappings between Vertica and Oracle
Oracle uses proprietary data types for all main data types, such as VARCHAR, INTEGER, FLOAT, DATE. Before migrating a database from Oracle to Vertica, first convert the schema to minimize errors and time spent fixing erroneous data issues.
The following table compares the behavior of Oracle data types to Vertica data types.
Oracle | Vertica | Notes |
---|---|---|
(no explicit precision) |
INTEGER |
In Oracle, the NUMBER data type with no explicit precision stores each number N as an integer M, together with a scale S. The scale can range from -84 to 127, while the precision of M is limited to 38 digits. Thus: N = M * 10^S When precision is specified, precision/scale applies to all entries in the column. If omitted, the scale defaults to 0. For the common case—Oracle NUMBER with no explicit precision used to store only integer values—the Vertica INTEGER data type is the most appropriate and the fastest equivalent data type. However, INTEGER is limited to a little less than 19 digits, with a scale of 0: |
NUMERIC |
If an Oracle column contains integer values outside of the range If the data is exact with fractional places—for example dollar amounts—Vertica recommends NUMERIC(p,s) where p is the precision (total number of digits) and s is the maximum scale (number of decimal places). Vertica conforms to standard SQL, which requires that p ≥ s and s ≥ 0. Vertica's NUMERIC data type is most effective for p=18, and increasingly expensive for p=37, 58, 67, etc., where p ≤ 1024. TipVertica recommends against using the data type NUMERIC(38,s) as a default "failsafe" mapping to guarantee no loss of precision. NUMERIC(18,s) is better, and INTEGER or FLOAT better yet, if one of these data types will do the job. | |
FLOAT | Even though no explicit scale is specified for an Oracle NUMBER column, Oracle allows non-integer values, each with its own scale. If the data stored in the column is approximate, Vertica recommends using the Vertica data type FLOAT, which is standard IEEE floating point, like ORACLE BINARY_DOUBLE. | |
NUMBER(P,0) P ≤ 18 |
INTEGER | For Oracle NUMBER data types with 0 scale and a precision less than or equal to 18, use the Vertica INTEGER data type. |
NUMBER(P,0) P > 18 |
NUMERIC(p,0) | In the rare case where a Oracle column specifies precision greater than 18, use the Vertica data type NUMERIC(p, 0), where p = P. |
NUMBER(P,S) All cases other than above |
NUMERIC(p,s) |
|
FLOAT | ||
NUMERIC(P,S) | Rarely used in Oracle, see notes for Oracle NUMBER. | |
DECIMAL(P,S) | Synonym for Oracle NUMERIC. | |
BINARY_FLOAT | FLOAT | Same as FLOAT(53) or DOUBLE PRECISION |
BINARY_DOUBLE | FLOAT | Same as FLOAT(53) or DOUBLE PRECISION |
RAW | VARBINARY |
Maximum sizes compared:
|
LONG RAW | LONG VARBINARY |
Maximum sizes compared:
CautionBe careful to avoid truncation when migrating Oracle LONG RAW data to Vertica. |
CHAR(n) | CHAR(n) |
Maximum sizes compared:
|
NCHAR(n) | CHAR(*n**3) | Vertica supports national characters with CHAR(n) as variable-length UTF8-encoded UNICODE character string. UTF-8 represents ASCII in 1 byte, most European characters in 2 bytes, and most oriental and Middle Eastern characters in 3 bytes. |
VARCHAR2(n) | VARCHAR(n) |
Maximum sizes compared:
ImportantThe Oracle VARCHAR2 and Vertica VARCHAR data types are semantically different:
|
NVARCHAR2(n) | VARCHAR(*n**3) | See notes for NCHAR. |
DATE | TIMESTAMP | Oracle’s DATE is different from the SQL standard DATE data type implemented by Vertica. Oracle’s DATE includes the time (no fractional seconds), while Vertica DATE data types include only date as per the SQL standard. |
DATE | ||
TIMESTAMP | TIMESTAMP | TIMESTAMP defaults to six places—that is, to microseconds. |
TIMESTAMP WITH TIME ZONE | TIMESTAMP WITH TIME ZONE | TIME ZONE defaults to the currently SET or system time zone. |
INTERVAL YEAR TO MONTH | INTERVAL YEAR TO MONTH | As per the SQL standard, you can qualify Vertica INTERVAL data types with the YEAR TO MONTH subtype. |
INTERVAL DAY TO SECOND | INTERVAL DAY TO SECOND | The default subtype for Vertica INTERVAL data types is DAY TO SECOND. |
CLOB | LONG VARCHAR |
You can store a CLOB (character large object) or BLOB (binary large object) value in a table or in an external location. The maximum size of a CLOB or BLOB is 128 TB. You can store Vertica LONG data types only in LONG VARCHAR and LONG VARBINARY columns. The maximum size of LONG data types is 32M bytes. |
BLOB | LONG VARBINARY | |
LONG | LONG VARCHAR |
Oracle recommends using CLOB and BLOB data types instead of LONG and LONG RAW data types. An Oracle table can contain only one LONG column, The maximum size of a LONG or LONG RAW data type is 2 GB. |
LONG RAW | LONG VARBINARY |