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:
1 | SELECT ABS (1.23) |
2 | FROM DUAL; |
Will return “1.23”
Example 2:
1 | SELECT ABS (-1.23) |
2 | FROM DUAL; |
Will return “1.23”
Example 3:
1 | SELECT ABS (-1.23 *1) |
2 | FROM DUAL; |
Will return “1.23”
Example 4:
1 | SELECT ABS (1.23 *-1) |
2 | FROM DUAL; |
Will return “1.23”