We are excited to announce that the ASP.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

## 3 replies

Last post May 22, 2014 03:43 PM by Rion Williams

• priya15_pate...

Member

19 Points

164 Posts

### round a number in oracle

dear all,

i need to round a number to its whole number like if the number is 15500 i need to round it to 15000. ,14450  then 14400 etc.

number round oracle in

• Perkinsville

Participant

860 Points

206 Posts

### Re: round a number in oracle

Hi,

Have you tried ROUND(num)?

http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions135.htm

HTH, Benjamin

number round oracle in

• Lannie

Contributor

3532 Points

1349 Posts

### Re: round a number in oracle

TRUNC(var, -3)

TRUNC(15500,-3) = 15000

TRUNC(15700,-3) = 15000

If you need to round UP then you will have to use ROUND function

number round oracle in

• Rion William...

All-Star

114593 Points

18503 Posts

MVP

### Re: round a number in oracle

May 22, 2014 03:43 PM|Rion Williams|LINK

Have you tried using the ROUND function?

It accepts two parameters, the first being the value or column that you intend to round and the second can accept a variety of different arguments to designate how the value would be rounded.

For example, if you wanted to round your value to the nearest thousand, you might use :

`SELECT ROUND(yourColumnToRound 1000)`

or if you needed to round to the nearest hundreth, you might use :

`SELECT ROUND(yourColumnToRound 100)`

Typically, the values that you provided would round up, so if you wanted to explicitly handle these to round down, you might consider subtracting 1 from them (to trigger a rounding down effect on these "halfway" values). I'm sure there is likely some "rounded floor" function that someone with more experience in Oracle could provide that might be a bit cleaner than that approach.

number round oracle in