Important We are integrating BMC AMI LOBMaster technology into the BMC AMI Reorg product and discontinuing BMC AMI LOBMaster as a separate product. For the latest integrated documentation, see BMC AMI Reorg for Db2 13.1.

DECIMAL or DEC


The DECIMAL function returns a decimal representation of a number.

DECIMAL.png


The arguments are defined as follows:

numericExpression

numericExpression is converted to a decimal data type with the specified precision and scale. The data type of the numeric expression can be:

  • SMALLINT
  • INTEGER
  • BIGINT
  • FLOAT
  • REAL
  • DECIMAL
  • DECFLOAT

stringExpression

If the argument is a string expression, it can be in any external numerical format. It is converted directly to decimal data type. If the string expression has a decimal point, the number is converted to the implied precision and scale, then rescaled to the specified precision and scale. No rounding takes place. Truncation of the fractional part may take place. A decimal point conversion overflow will be declared if a loss of precision is detected.

If the CCSID of the string is not in EBCDIC encoding scheme, it is cast to EBCDIC CCSID (37) before conversion takes place.

Other special strings are accepted and converted to their internal DECFLOAT values. These include:

  • NAN
  • SNAN
  • INF
  • INFINITY

precision

The precision argument must be an integer constant with a value in the range of 1 through 31. The value of this second argument specifies the precision of the result.

The default value depends on the data type of the first argument, as follows:


Data type

Default precision value

SMALLINT

5

INTEGER

11

BIGINT

19

DECFLOAT

31

All other cases

15

scale

The scale argument must be an integer constant that is greater than or equal to zero and less than or equal to precision. The value specifies the scale of the result. The default value is 0.


Important

If the argument can be null, the result can be null; if the argument value is null, the result is the null value.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*