Purpose
The ABS function returns the absolute value of numeric_expression. The ABS function changes negative values to positive values and has no effect on zero or positive values.
Syntax
ABS(numeric_expression)
Parameters
| Parameter | Description |
|---|---|
| numeric_expression | An expression of exact or approximate numeric data type (NUMBER, FLOAT, BINARY_FLOAT, and BINARY_DOUBLE). |
Return type
The same data type as numeric_expression.
Examples
Return the absolute values of -1.0, 0.0, 6.66, and (3-6).
obclient> SELECT ABS(-1.0), ABS(0), ABS(6.66), ABS(3-6) FROM DUAL;
+-----------+--------+-----------+----------+
| ABS(-1.0) | ABS(0) | ABS(6.66) | ABS(3-6) |
+-----------+--------+-----------+----------+
| 1 | 0 | 6.66 | 3 |
+-----------+--------+-----------+----------+
1 row in set
