Welcome to plsql4all.blogspot.com SQL, MYSQL, ORACLE, TERADATA, MONGODB, MARIADB, GREENPLUM, DB2, POSTGRESQL.

Saturday 6 September 2014

ROUND function in Oracle

ROUND function is used to round the number of decimal places. ROUND function takes two parameters,
one is the number to round and second is the number of decimal it should round to.

You must provide second parameter otherwise it will round the number to 0 decimal.

Syntax is:-

ROUND(NUMERIC_FIELD,[ROUND_NUMBER_TO_DECIMAL]);

Example:-

SELECT ROUND(30.545,2) ROUND_TO FROM DUAL;

--> 30.54

SELECT ROUND(30.5031,2) ROUND_TO FROM DUAL;

--> 30.5

Note:- Above it have rounded to number to two decimal but since the 0 is second decimal so it will skip the same.

SELECT ROUND(800.7854,3) ROUND_TO FROM DUAL;

--> 800.785

SELECT ROUND(300.6564) ROUND_TO FROM DUAL;

--> 300




Read Also:- ROUND function in SQL

No comments:

Post a Comment

Please provide your feedback in the comments section above. Please don't forget to follow.