Previous Topic Next topic Print topic


DECIMAL

ANSI DB2 SQL/DS XDB
  X   X

Transforms a number to the decimal representation of the numeric value having a specified precision and scale. The format appears below:

DECIMAL(x [, precision [, scale]])

The parameter precision, if specified, must be between 1 and 31, inclusive. If precision is omitted, the default precision depends on the data type of the first argument. If x is a floating point number or decimal, the default precision is 15. If the parameter x is an integer the default precision is 11. If x is a small integer, the default precision is 5. The parameter scale, if specified, must be in the range of 0 to precision. If omitted, scale is assumed to be 0. For example:

SELECT DECIMAL(quantity, 5, 2)
FROM items
Previous Topic Next topic Print topic