NUMERIC data type

The NUMERIC data types is used to store decimal numbers with precision total digits and with scale digits after the decimal point.

Syntax
NUMERIC [ ( precision [ , scale ] ) ]
Parameters
  • precision   An integer expression between 1 and 127, inclusive, that specifies the number of digits in the expression. The default setting is 30.

  • scale   An integer expression between 0 and 127, inclusive, that specifies the number of digits after the decimal point. The scale value should always be less than or equal to the precision value. The default setting is 6.

    The defaults can be changed by setting database options. For information, see precision option [database] and scale option [database].

Remarks

The NUMERIC data type is an exact numeric data type; its accuracy is preserved to the least significant digit after arithmetic operations.

The number of bytes required to store a decimal number can be estimated as

2 + INT( (BEFORE+1)/2 ) + INT( (AFTER+1)/2 )

The INT function takes the integer portion of its argument, and BEFORE and AFTER are the number of significant digits before and after the decimal point. The storage is based on the value being stored, not on the maximum precision and scale allowed in the column.

NUMERIC is semantically equivalent to DECIMAL.

See also
Standards and compatibility
  • SQL/2003   Compatible with SQL/2003 if the scale option is set to zero.