RE: Number problem

  • From: "Carel-Jan Engel" <cjpengel.dbalert@xxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Thu, 23 Dec 2004 13:58:49 +0100 (CET)

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
>
>
>
> --
> //www.freelists.org/webpage/oracle-l
>

Regards, Carel-Jan

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





--
//www.freelists.org/webpage/oracle-l

Other related posts: