Oracle / PLSQL: ROUND Function (with numbers)
This Oracle tutorial explains how to use the Oracle/PLSQL ROUND function (as it applies to numeric values) with syntax and examples.
Description
The Oracle/PLSQL ROUND function returns a number rounded to a certain number of decimal places.
Syntax (with numbers)
The syntax for the ROUND function in Oracle/PLSQL is:
ROUND( number [, decimal_places] )
Parameters or Arguments
- number
- The number to round.
- decimal_places
- Optional. The number of decimal places rounded to. This value must be an integer. If this parameter is omitted, the ROUND function will round the number to 0 decimal places.
Returns
The ROUND function (as it applies to numbers) returns a numeric value.
Applies To
The ROUND function can be used in the following versions of Oracle/PLSQL:
- Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i
Example - with numbers
Let's look at some Oracle ROUND function examples and explore how to use the ROUND function in Oracle/PLSQL.
For example:
ROUND(125.315) Result: 125 ROUND(125.315, 0) Result: 125 ROUND(125.315, 1) Result: 125.3 ROUND(125.315, 2) Result: 125.32 ROUND(125.315, 3) Result: 125.315 ROUND(-125.315, 2) Result: -125.32
Advertisements