When you create a table, you must specify a data type for each column in the table. A data type defines the type of data that can be stored in a column. For example, a DATE column can store values like "2020-02-20" but cannot store numbers such as 2 or strings such as "hello".
For more information about SQL data types, see SQL Reference (Oracle mode). The following table describes some general data types.
| Category | Type | Remarks |
|---|---|---|
| Numeric data types | NUMBER[( p [, s ])] | p stands for precision and the maximum precision is 38. s stands for scale, the number of digits after the decimal point, and the scale can range from -84 to 127. * A value with both precision and scale is a fixed-point value. * A value with a scale of 0 is an integer value. * A value without precision and scale is a floating-point value with a maximum precision of 38. |
| Numeric data types | FLOAT [( p )] | float(p) is a subtype of the NUMBER data type. The precision ranges from 1 to 126 binary digits. You cannot specify the number of decimal places. |
| Numeric data types | BINARY_FLOAT | A 32-bit floating-point number, with a size of 4 bytes. |
| Numeric data types | BINARY_DOUBLE | A 64-bit floating-point number, with a size of 8 bytes. |
| String data type | CHAR(n) | Maximum length: 2,000 bytes |
| String data type | VARCHAR2(N) | Maximum length: 32,767 bytes |
| String data type | NCHAR(N) | Maximum length: 2,000 bytes |
| String data type | NVARCHAR2(N) | Maximum length: 32,767 bytes |
| Date and time data types | DATE | The DATE type is used for values that contain only a date. The DATE values are retrieved and displayed in YYYY-MM-DD format. |
| Date and time data types | TIMESTAMP | The TIMESTAMP type is used for values that contain both date and time (exclusive of the time zone). |
| Date and time data types | TIMESTAMP WITH TIME ZONE | The TIMESTAMP WITH TIME ZONE data type is used for values that contain both date and time. |
| Date and time data types | TIMESTAMP WITH LOCAL TIME ZONE | The TIMESTAMP WITH LOCAL TIME ZONE data type is used for values that contain both date and time. |
| Date and time data types | INTERVAL YEAR TO MONTH | A time interval in years and months. |
| Date and time data types | INTERVAL DAY TO SECOND | A time interval in days, hours, minutes, and seconds. |
| RAW data types | RAW(N) | Raw binary data with a size of N bytes. |
| Large-object data types | BLOB | Maximum length: 48 MB |
| Large-object data types | CLOB | Maximum length: 48 MB |