Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Number problem

RE: Number problem

From: Carel-Jan Engel <cjpengel.dbalert_at_xs4all.nl>
Date: Thu, 23 Dec 2004 13:58:49 +0100 (CET)
Message-ID: <24329.193.172.248.131.1103806729.squirrel@193.172.248.131>


Steve,

Forgive me if my understanding of English misleads me, but rounding UP to the NEAREST sounds as an oximoron to me.

Let's start defining 'the nearest 50000' first.

IMHO, the nearest 5000 of 96136462 is 96135000, and not 9614000 or 961400000 (you forgot a 0, I guess).

Given that, this should round the number to the nearest 5000.

SQL> select round(96136462/5000,0) * 5000 from dual;

ROUND(96136462/5000,0)*5000


                   96135000

If you want to round UP to the 'NEXT 5000', you can try this:

SQL> select round((96136462+4999)/5000,0) * 5000 from dual;

ROUND((96136462+4999)/5000,0)*5000


                          96140000

And there are many other (likely better) ways to achive this, but this works for me.

Regards, Carel-Jan

===
If you think education is expensive, try ignorance. (Derek Bok) ===

> Within Oracle, how can I round up an 8 figure number to the nearest 5000
> such that 96136462 becomes 9614000 and 96130045 becomes 96135000?
> Maths was never my strong point!!! ;-)
>
> Steve
>
>
>
> --
> http://www.freelists.org/webpage/oracle-l
>

Regards, Carel-Jan

===
If you think education is expensive, try ignorance. (Derek Bok) ===

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Dec 23 2004 - 06:53:18 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US