Skip to main content

Fixed-point types

Fixed-point types are variable-length, exact numeric types. The range and precision depend on the Precision and Scale values and whether the type is unsigned.

DECIMAL is equivalent to NUMERIC. The syntax is as follows:

DECIMAL[(M[,D])] [UNSIGNED] [ZEROFILL]

M specifies the total number of digits (Precision), and D specifies the number of digits after the decimal point (Scale). The decimal point and the minus sign "-" are not counted in M. If D is 0, the value has no decimal point or decimal part. The maximum number of digits in the integer part is equal to the value of M minus D, which is the value of Precision minus Scale. All basic operations on columns of the DECIMAL type (+, -, *, /) use a precision of 65.

The maximum value of M for DECIMAL is 65, and the maximum value of D is 30. If you omit D, the default value is 0. If you omit M, the default value is 10.

If you specify ZEROFILL for a numeric column, seekdb automatically adds the UNSIGNED attribute to the column. If you specify UNSIGNED, the value cannot be negative.

For example, DECIMAL(5,2) specifies a maximum of 3 digits in the integer part and 2 digits in the decimal part. Therefore, the value range is [-999.99, 999.99]. If you also specify UNSIGNED, the value range is [0, 999.99].

The following types are synonyms for DECIMAL. FIXED is used for compatibility with other database systems.

DEC[(M[,D])] [UNSIGNED] [ZEROFILL], NUMERIC[(M[,D])] [UNSIGNED] [ZEROFILL], FIXED[(M[,D])] [UNSIGNED] [ZEROFILL]