Friday, January 11, 2013

Round Function (with numbers)


In Oracle/PLSQL, the round function returns a number rounded to a certain number of decimal places.

Syntax

The syntax for the round function is:
round( number, [ decimal_places ] )
number is the number to round.
decimal_places is 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.

Applies To

  • Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i

For Example

round(125.315)would return 125
round(125.315, 0)would return 125
round(125.315, 1)would return 125.3
round(125.315, 2)would return 125.32
round(125.315, 3)would return 125.315
round(-125.315, 2)would return -125.32