PolarDB for Oracle supports the following built-in general-purpose data types.
Numeric types
| Name | Alias | Description |
|---|---|---|
INTEGER | INT, BINARY INTEGER, PLS INTEGER | Signed four-byte integer |
NUMBER | DEC, DECIMAL, NUMERIC | Exact numeric with optional decimal places |
NUMBER(p [, s]) | DEC(p [, s]), DECIMAL(p [, s]), NUMERIC(p [, s]) | Exact numeric of maximum precision p and optional scale s |
DOUBLE PRECISION | FLOAT, FLOAT(25)-FLOAT(53) | Double precision floating-point number |
REAL | FLOAT(1)-FLOAT(24) | Single precision floating-point number |
Character types
| Name | Alias | Description |
|---|---|---|
CHAR [(n)] | CHARACTER [(n)] | Fixed-length character string of n characters |
VARCHAR2(n) | CHAR VARYING(n), CHARACTER VARYING(n), VARCHAR(n) | Variable-length character string with a maximum length of n characters |
CLOB | LONG, LONG VARCHAR | Long character string |
Date and time types
| Name | Alias | Description |
|---|---|---|
DATE | TIMESTAMP(0) | Date and time to the second |
TIMESTAMP [(p)] | - | Date and time with optional fractional second precision p |
TIMESTAMP [(p)] WITH TIME ZONE | - | Date and time with optional fractional second precision p, and with time zone |
Binary and other types
| Name | Alias | Description |
|---|---|---|
BLOB | LONG RAW, RAW(n), BYTEA | Binary data |
BOOLEAN | - | Logical Boolean (true/false) |
XMLTYPE | - | XML data |
Usage notes
Oracle-originated names such as
NUMBER,VARCHAR2,CLOB,BLOB, andXMLTYPEare the primary type names for PolarDB for Oracle. Use these names when writing new applications on PolarDB for Oracle or migrating from Oracle.SQL standard aliases such as
NUMERIC,CHARACTER VARYING, andDECIMALare accepted interchangeably. Use these when portability to other SQL-standard databases is a requirement.For
NUMBER(p [, s]), p is the total number of significant digits (precision) and s is the number of digits to the right of the decimal point (scale).DATEstores date and time to the second and is equivalent toTIMESTAMP(0). It differs from the SQL standardDATEtype, which stores date only.