Main Tutorials

Oracle PL/SQL – ACOS function example

The ACOS() function returns the arc cosine of input n, the input n must be in the range of -1 to 1. The function will return a value in the range of 0 to pi, expressed in radians.

ACOS function examples


SELECT ACOS(.2) FROM DUAL;
-- output
1.36943840600456582777619613942212803186

SELECT ACOS(-.4) FROM DUAL; 
-- output
1.98231317286238463861605958925708704694

SELECT ACOS(-1) FROM DUAL;  
-- output
3.1415926535897932384626433832795028842

SELECT ACOS(1) FROM DUAL;   
-- output
0

Pass value 1.2 which is not in range -1 to 1, and notice the error.


SELECT ACOS(1.2) FROM DUAL;

-- output
ORA-01428: argument '1.2' is out of range
01428. 00000 -  "argument '%s' is out of range"

References

  1. ACOS Function :- Oracle official docs

About Author

author image
Dhaval Dadhaniya is a software engineer by profession and reader/writter by passion. He is working in a well reputed MNC as an applications Developer with 5 years of experience. He have good understanding and knowledge of Java, Database, Spring, Hibernate and exploring other technologies related to Software development. Befriend him on Facebook

Comments

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments