The ABS function in Oracle SQL / PLSQL is used to get the absolute value of a number.
Syntax for the ABS function in Oracle SQL / PLSQL is:
SELECT ABS(number)
FROM table_name;
- ‘number’ is the number that has to be converted to an absolute value
Example 1:
SELECT ABS(1.23) FROM DUAL;
Will return “1.23”
Example 2:
SELECT ABS(-1.23) FROM DUAL;
Will return “1.23”
Example 3:
SELECT ABS(-1.23 *1) FROM DUAL;
Will return “1.23”
Example 4:
SELECT ABS(1.23 *-1) FROM DUAL;
Will return “1.23”