Oracle PL/SQL – ABS function example

This ABS() function returns absolute value of a number, for example, the absolute value of 5 is 5, and the absolute value of -5 is also 5. In Mathematics, absolute value can be think of as a distance from zero.

ABS function examples


SELECT ABS(-15) FROM DUAL; -- 15

SELECT ABS(-51.321) FROM DUAL; --51.321

SELECT ABS(-20+12) FROM DUAL; -- 8

SELECT ABS(-5*6) FROM DUAL; -- 30

SELECT ABS(12/-3) FROM DUAL; -- 4

References

  1. ABS Function :- Oracle official docs
  2. Wikipedia – Absolute value

About the Author

author image
Dhaval Dadhaniya
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

avatar