Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

DECIMAL - Fixed-point numbers

You use the data type DECIMAL for columns that can store fixed-point numbers (see section "Numeric values").

Unlike NUMERIC, the internal representation of DECIMAL is shorter and more efficient for calculation purposes.


[{[ dimension ] | ( dimension )}] DEC[IMAL][( precision [, scale ])]



dimension

Unsigned integer between 1 and 255. The column is a multiple column;
dimension indicates the number of column elements.

Any square brackets shown here in italics are special characters, and must be specified in the statement.

dimension omitted:
The column is an atomic column.


precision

Unsigned integer between 1 and 31 that indicates the total number of significant digits.

precision omitted:
precision=1.


scale

Unsigned integer between 0 and precision that indicates the number of digits to the right of the decimal point.

scale omitted:
scale=0.


Range of values for DECIMAL fixed-point columns

A DECIMAL fixed-point column can contain fixed-point numbers whose value is 0 or ranges

from 10 -scale to 10 precision-scale-10 -scale.


Example

You define a DECIMAL column weight with six digits to the left of the decimal point and two digits to the right of the decimal point as follows:

weight DECIMAL(8,2)