Syntax
ABS(expr)
Purpose
ABS() calculates the absolute value of an expression. The return type is the same as the data type of the numeric expression.
Comparison operations are supported. The comparison result is a Boolean value, which is converted into a numeric value. The result is 1 (TRUE) or 0 (FALSE).
If you enter NULL, NULL is returned.
If you enter a string of digits, it can be automatically converted into a numeric value. The return value is converted into a BIGINT value.
Examples
obclient> SELECT ABS(5), ABS(-5.777), ABS(0), ABS(1/2), ABS(1-5);
+--------+-------------+--------+----------+----------+
| ABS(5) | ABS(-5.777) | ABS(0) | ABS(1/2) | ABS(1-5) |
+--------+-------------+--------+----------+----------+
| 5 | 5.777 | 0 | 0.5000 | 4 |
+--------+-------------+--------+----------+----------+
1 row in set