Open In App

PLSQL | ASIN Function

Last Updated : 06 Oct, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
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 any numeric data type or any non-numeric data type that can be implicitly converted to a numeric data type. Syntax:
ASIN( number )
Parameters Used: number - It is used to specify the number arc sine needs to be calculated. Return Value: The ASIN function in PLSQL returns a numeric value. Supported Versions of Oracle/PLSQL:
  1. Oracle 12c
  2. Oracle 11g
  3. Oracle 10g
  4. Oracle 9i
  5. Oracle 8i
Example-1: Using a positive numeric value as an argument in the ASIN function.
DECLARE 
   Test_Number number := 0.5;
   
BEGIN 
   dbms_output.put_line(ASIN(Test_Number)); 
   
END; 
Output:
0.52359877559829887307710723054658381405 
Example-2: Using a negative numeric value as an argument in the ASIN function.
DECLARE 
   Test_Number number := -0.5;
   
BEGIN 
   dbms_output.put_line(ASIN(Test_Number)); 
   
END;  
Output:
-0.52359877559829887307710723054658381405 
Example-3: Using a numeric value which doesn't fall in the range between -1 and 1 as an argument in the ASIN function.
DECLARE 
   Test_Number number := 2.5;
   
BEGIN 
   dbms_output.put_line(ASIN(Test_Number)); 
   
END;  
Output:
ERROR
ORA-01428: argument '2.5' is out of range 
The above program throws an error since the argument passed is exceeding the range which can be accepted. Example-4: Using ASIN function with select query.
SELECT ASIN(.4) FROM dual; 
Output:
0.41151684606748806 
Example-5: Using ASIN function with select query and returning the value in degree.
select (ASIN(.4)) * 57.29  FROM dual; 
Output:
23.57580011120639 
Using the conversion formula of 1 radian = 57.29 degrees. Advantages: The ASIN function accepts any numeric datatype or any nonnumeric datatype as an argument that can be implicitly converted to a numeric datatype.

Article Tags :

Similar Reads