Table of Contents
This chapter introduces the default data types provided in Tibero and describes their usage.
Data type is used when a schema object is created for a database. General client programs can use variables that corresponds to all data types.
Data types provided in Tibero are:
For more information about data types, refer to Tibero SQL Reference Guide.
The following describes how to use string data types.
The CHAR type stores fixed-length character strings.
Used in the following way:
CHAR[(size[BYTE|CHAR])]
Option | Description |
---|---|
size | The size option can be set. (Maximum: 2,000 bytes)
|
The VARCHAR and VARCHAR2 types store variable-length character strings.
Used in the following way:
VARCHAR(size[BYTE|CHAR]) VARCHAR2(size[BYTE|CHAR])
Option | Description |
---|---|
size | The data length is the byte length of the data. (Maximum: 65,532 bytes) |
The NCHAR type stores fixed-length character strings that use the national character set.
Used in the following way:
NCHAR(size)
Option | Description |
---|---|
size | The data length is the byte length of the data. (Maximum: 2,000 bytes) |
The NVARCHAR type stores variable-length character strings that use the national character set.
Used in the following way:
NVARCHAR(size)
Option | Description |
---|---|
size | The data length is the byte length of the data. (Maximum: 4,000 bytes) |
The CLOB type stores a large amount of readable strings.
Used in the following way:
CLOB
The maximum data size is 4GB.
The NCLOB type stores a large amount of readable strings that use the national character set.
Used in the following way:
NCLOB
The maximum data size is 4GB.
The LONG type stores a large amount of strings. This type is supported only for compatibility with Oracle. The CLOB type is recommended for all other purposes.
Used in the following way:
LONG
The following describes how to use number data types.
The NUMBER type stores variable-length integers or real numbers.
Used in the following way:
NUMBER[(precision[, scale])]
Option | Description |
---|---|
precision | Total number of digits. |
scale | The number of digits to the right of the decimal point. |
The following describes how to use datetime data types.
The DATE type stores fixed-length strings of year, month, and date.
Used in the following way:
DATE
The TIME type stores fixed-length strings of hour, minute, and second.
Used in the following way:
TIME
The TIMESTAMP type is an expanded type of the DATE type. This type stores a fixed-length string of year, month, date, and time.
Used in the following way:
TIMESTAMP[(fractional_seconds_precision)]
Option | Description |
---|---|
fractional_seconds_precision | Fractional seconds precision.
|
The TIMESTAMP WITH TIME ZONE type is an expanded type of the TIMESTAMP type. This type converts a given time to UTC (Coordinated Universal Time) time format, and stores a fixed-length string made of year, month, date, and time.
Used in the following way:
TIMESTAMP[(fractional_seconds_precision)] WITH TIME ZONE
Option | Description |
---|---|
fractional_seconds_precision | Fractional seconds precision.
|
The TIMESTAMP WITH LOCAL TIME ZONE type converts a given time to a time in UTC time like TIMESTAMP WITH TIME ZONE, and stores a fixed-length string made of year, month, and date. This type has the same length as TIMESTAMP.
Used in the following way:
TIMESTAMP[(fractional_seconds_precision)] WITH LOCAL TIME ZONE
Option | Description |
---|---|
fractional_seconds_precision | Fractional seconds precision.
|
The following describes how to use interval data types.
The INTERVAL YEAR TO MONTH type stores a fixed-length time interval of year and month.
Used in the following way:
INTERVAL YEAR [(year_precision)] TO MONTH
Option | Description |
---|---|
year_precision | Year precision.
|
The INTERVAL DAY TO SECOND type stores a fixed-length time interval of day and time.
Used in the following way:
INTERVAL DAY [(day_precision)] TO SECOND [(fractional_seconds_precision)]
Option | Description |
---|---|
day_precision | Day precision.
|
fractional_seconds_precision | Same as the fractional_seconds_precision option of the TIMESTAMP type. |
This type can limit the number of digits stored for date and fractional second using day_precision and fractional_seconds_precision.
The following describes how to use binary data types.
The RAW type stores variable-length binary data.
Used in the following way:
RAW(size)
Option | Description |
---|---|
size | The data length is the byte length of the data. (Maximum: 2,000 bytes) |
The BLOB type stores a large amount of binary data.
Used in the following way:
BLOB
The maximum data size is 4GB.
The LONG RAW type stores a large amount of binary data. This type is supported only for compatibility with Oracle. The BLOB type is recommended for all other purposes.
Used in the following way:
LONG RAW