DB2 Scalar functions - ABS or ABSVAL


Volta a página anterior

Volta ao Menu das scalar functions

Volta ao Menu Principal


Desenvolvido por DORNELLES Carlos Alberto - Analista de Sistemas - Brasília DF. - cad_cobol@hotmail.com

ABS or ABSVAL

Returns the absolute value of the argument.

ABSABSVAL(expression)

The schema is SYSIBM.

The SYSFUN version of the ABS (or ABSVAL) function continues to be available.

expression
An expression that returns a value of any built-in numeric data type.

The result has the same data type and length attribute as the argument.
The result can be null; if the argument is null, the result is the null value.
If the argument is the maximum negative value for SMALLINT, INTEGER or BIGINT, the result is an overflow error.

Notes

Results involving DECFLOAT special values:
For decimal floating-point values, the special values are treated as follows:

  • ABS(NaN) and ABS(-NaN) return NaN.
  • ABS(Infinity) and ABS(-Infinity) return Infinity.
  • ABS(sNaN) and ABS(-sNaN) return sNaN.

Example

   ABS(-51234)

returns an INTEGER with a value of 51234.


© Copyright IBM Corp.