The ROUND Function

The ROUND function is used to round a numeric value to a specified precision. If the value is less than 5, the function rounds down. If the value is greater than or equal to 5, the function rounds the value up. The function contains two parameters: The first is the value or column name, and the second is the precision. Listing 7.4 illustrates a query that rounds a calculated value. The first function has a precision setting of 2, which causes the value to be rounded to hundredths. The second function has a setting of –2, which causes the precision to be set at hundreds.

Listing 7.4. Using the ROUND Function to Round to the Nearest Hundredth and Hundred
 SQL> select last_name, wages/3, 2 round(wages/2,2), round(wages/3,-2) ...

Get Oracle SQL and PL/SQL Handbook: A Guide for Data Administrators, Developers, and Business Analysts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.