How Can We Help?
Introduction:
In this tutorial, we are going to explain how to use Oracle ABS function with basic syntax and many examples for better understanding.
How to get the absolute value in Oracle? To get the absolute value in Oracle, we use ABS function to return the absolute value of a number value passed to.
Oracle Absolute Value Function Syntax:
ABS(number_value)
Name | Description |
---|---|
number_value | The value to be passed to the function in number format. |
Examples:
Let’s take some examples about Oracle ABS and how to use it:
Example (1)
SELECT ABS(-90)
FROM DUAL;
Output:
ABS(-90) |
---|
90 |
Example (2)
SELECT ABS(-9.6)
FROM DUAL;
Output:
ABS(-9.6) |
---|
9.6 |
Example (3)
SELECT ABS(008)
FROM DUAL;
Output:
ABS(008) |
---|
8 |
Example (4)
SELECT ABS(45.69 * -1)
FROM DUAL;
Output:
ABS(45.69 * -1) |
---|
45.69 |
Similar functions to Oracle ABS or Oracle Absolute Value:
LEAST : returns the smallest value of given list of values.
GREATEST : returns the greatest value of given list of values.
SUM : returns the sum of expression or columns.
ROUND : rounds the column, expression, or value to n decimal places
In this tutorial, you have learned how to use the ABS function to get the absolute value of a number value passed to.
Hopefully, it was clear and concise.