ABS

Click to skip syntax diagram
Read syntax diagramSkip visual syntax diagram>>-ABS--(--expression--)---------------------------------------><
 

The ABS function returns the absolute value of a number.

expression
The argument must be an expression that returns a value of any built-in numeric, character-string, or graphic-string data type. A string argument is cast to double-precision floating point before evaluating the function. For more information on converting strings to double-precision floating point, see DOUBLE_PRECISION or DOUBLE.

The data type and length attribute of the result are the same as the data type and length attribute of the argument value, except that the result is a large integer if the argument value is a small integer, and the result is double-precision floating point if the argument value is single-precision floating point.

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

Note

Syntax alternatives: ABSVAL is a synonym for ABS. It is supported only for compatibility with previous DB2(R) releases.

Example