Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Round the number to nearest 10k

NicloeiWNov 1 2012 — edited Nov 1 2012
Hi,
I am facing small issue, i need to round the number to the nearest 10k for some finance reporting 

ex
1. if number is 2250 round to 10,000
2. if number is 5500 round to 10,000
3. if number is 4912345 round to 4920000
etc..

the number should always round up to nearest 10k..

I am using round function to achieve this.. 

case 1:- 
SQL> Select round(2250,-4) From dual;
 
ROUND(2250,-4)
--------------
             0

I need 10,000 here..

case 2:- 
SQL> Select round(5500 ,-4) From dual;
 
ROUND(5500,-4)
--------------
         10000
 
SQL> 

This is working fine...

case 3:- 
SQL> Select round(4912345 ,-4) From dual;
 
ROUND(4912345,-4)
-----------------
          4910000

This should round UP to 4920000 

please let me know if there is any way i can achieve this...

regards
nic
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 29 2012
Added on Nov 1 2012
10 comments
1,604 views