Returns the absolute value of the input argument. Returns null if the input argument is null.
ABS ( <numeric-expression> <interval-expression> )
Function | Result |
---|---|
ABS(2.0) | 2.0 |
ABS(-1.0) | 1.0 |
ABS(0) | 0 |
ABS(-3 * 3) | 9 |
ABS(INTERVAL ‘-3 4:20’ DAY TO MINUTE) | INTERVAL ‘3 4:20’ DAY TO MINUTE |
In SQLline, using “cast as VARCHAR” to show the output, the value is returned as “+3 04:20”.
values(cast(ABS(INTERVAL '-3 4:20' DAY TO MINUTE) AS VARCHAR(8)));
+-----------+
  EXPR$0 Â
 +-----------+
 +3 04:20 Â
 +-----------+
 1 row selected