OceanBase AI Database supports all standard SQL numeric data types, including exact numeric types (INTEGER, SMALLINT, DECIMAL, and NUMERIC), approximate numeric types (FLOAT and DOUBLE), the BIT data type for storing bit values, and extended types (TINYINT, MEDIUMINT, BIGINT, and SERIAL).
Note
- The keywords
BOOL/BOOLEANare synonyms forTINYINT. - The keyword
INTis a synonym forINTEGER.
Numeric data types
The numeric data types supported by the current version of OceanBase AI Database can be classified into the following four categories:
Integer types:
BOOL/BOOLEAN/TINYINT,SMALLINT,MEDIUMINT,INT/INTEGER,BIGINT, andSERIAL.Fixed-point types:
DECIMALandNUMERIC.Floating-point types:
FLOATandDOUBLE.Bit-Value type:
BIT.
Numeric types can be defined with precision (the length of the field) and scale (the number of decimal places). The meaning of precision and scale varies by type. For details, see the descriptions of each type.
ZEROFILL attribute
Numeric types can be defined with the ZEROFILL keyword to specify a minimum display width, while implicitly defining the type as UNSIGNED. When the actual displayed width of a value is less than the specified minimum, the value is padded with zeros to meet the minimum display width by first padding the decimal part up to the upper limit of the scale and then padding the integer part up to the upper limit of the precision.
For example:
INT(5) ZEROFILL: When the data value is123, it will be displayed as00123.DECIMAL(10, 5) ZEROFILL: When the data value is123.456, it will be displayed as00123.45600.