PLSQL | ABS Function Last Updated : 06 Oct, 2019 Comments Improve Suggest changes Like Article Like Report The PLSQL ABS function is used for returning the absolute value of a number. Absolute value is used for depicting the distance of a number on the number line from 0. The direction of the number from zero is not considered since the absolute value of a number is never negative. The ABS in PLSQL function takes as an argument any numeric data type or any non-numeric data type that can be implicitly converted to a numeric data type. The value returned by the PLSQL ABS function is of the same data type as the numeric data type of the argument. Syntax: ABS( number ) Parameters Used: number - It is used to specify the number whose absolute value you want to know. Return Value: The ABS function in PLSQL returns a numeric value. Supported Versions of Oracle/PLSQL: Oracle 12c Oracle 11g Oracle 10g Oracle 9i Oracle 8i Example-1: Using a positive numeric value as an argument in the ABS function. DECLARE Test_Number int := 20; BEGIN dbms_output.put_line(ABS(Test_Number)); END; Output: 20 Example-2: Using a negative numeric value as an argument in the ABS function. DECLARE Test_Number int := -12; BEGIN dbms_output.put_line(ABS(Test_Number)); END; Output: 12 Example-3: Using a negative numeric value with decimal as an argument in the ABS function. DECLARE Test_Number decimal(7, 2) := -12.23; BEGIN dbms_output.put_line(ABS(Test_Number)); END; Output: 12.23 Example-4: Using an expression as an argument in the ABS function. DECLARE Test_Number decimal(11, 2) := (-20.45 * 2); BEGIN dbms_output.put_line(ABS(Test_Number)); END; Output: 40.9 Example-5: Using ABS function with select query. SELECT ABS(-20.45 * 1) FROM dual; Output: 20.45 Advantages: The ABS function accepts any numeric datatype as well as any non-numeric datatype as an argument that can be implicitly converted to a numeric datatype. Comment More infoAdvertise with us Next Article PLSQL | ABS Function S Shubrodeep Banerjee Follow Improve Article Tags : SQL SQL-PL/SQL Similar Reads PLSQL | ASIN Function The PLSQL ASIN function is used to return the arc sine of a number. The ASIN function only one parameter which is a number and the argument number must be in the range of -1 to 1, and the function returns a value in the range of -pi/2 to pi/2, expressed in radians. This function takes as an argument 2 min read PLSQL | ACOS Function The PLSQL ACOS function is used to return the arc cosine of a number. The ACOS function only one parameter which is a number and the argument number must be in the range of -1 to 1, and the function returns a value in the range of 0 to pi, expressed in radians. This function takes as an argument any 2 min read PLSQL | COS Function The PLSQL COS function is used to return the cosine of a numeric value. The COS function accepts one parameter which is the number whose cosine needs to be calculated. The COS function returns a value of the numeric data type. This function takes as an argument any numeric data type as well as any n 2 min read PLSQL | ATAN Function The PLSQL ATAN function is used to return the arc tangent of a number. The ATAN function accepts only one parameter which is a number and the range accepted for the argument number is unbounded. The ATAN function returns a value in the range of -pi/2 to pi/2, expressed in radians. This function take 2 min read PLSQL | COSH Function The PLSQL COSH function is used to return the hyperbolic cosine of a numeric value. The COSH function accepts one parameter which is the number whose hyperbolic cosine needs to be calculated. The COSH function returns a value of the numeric data type. This function takes as an argument any numeric d 2 min read PLSQL | ATAN2 Function The PLSQL ATAN2 function is used to return the arc tangent of n and m. The ATAN2 function is generally used if you want to convert cartesian coordinates to polar coordinates. The ATAN2 function accepts two parameters which are numbers and the range accepted by the argument n is unbounded. The ATAN2 2 min read PLSQL | FLOOR Function The FLOOR is an inbuilt function in PLSQL which is used to return the largest integer value which will be either equal to or less than from a given input number. Syntax: FLOOR(number) Parameters Used: This function accepts a parameter number which is the input number on which FLOOR function is calle 2 min read SQL Server ABS() Function The SQL Server ABS() function is a mathematical function used to return the absolute value of the given numeric expression. This function effectively removes any negative sign from input ensuring that the result is always non-negative. It is commonly used in data analysis and calculations where only 4 min read PLSQL | TAN Function The TAN function is an inbuilt function in PLSQL which is used to return the tangent of an input number. The tangent is a trigonometric function of an angle and here the input number is the angle expressed in the form of radians. 180 degree is equal to pi radian. Syntax: TAN( number ) Parameters Use 1 min read PLSQL | SIN Function The PLSQL SIN function is used to return the sine of a numeric value. The SIN function accepts one parameter which is the number whose sine needs to be calculated. The SIN function returns a value of the numeric data type. This function takes as an argument any numeric data type as well as any non-n 2 min read Like