RE: Number problem

Hi Steve,

Is this what you had in mind?

SQL> create table t as select rownum r from all_objects ;
Table created.
SQL> select r, count(*) from t group by r having count(*) > 1 ;
no rows selected
SQL> update t set r = (case when mod(r,5000) <= floor(5000/2) then
r-mod(r,5000) else r+5000-mod(r,5000) end) ;
32616 rows updated.
SQL> select r, count(*) from t group by r having count(*) > 1 ;
         R   COUNT(*)
---------- ----------
         0       2500
      5000       5000
     10000       5000
     15000       5000
     20000       5000
     25000       5000
     30000       5000
     35000        116
8 rows selected.
SQL>

Is it helpful?
-shiva



-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx]On Behalf Of Steve Jelfs
Sent: Thursday, December 23, 2004 6:08 PM
To: Oracle-L Freelists
Subject: Number problem


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

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

Other related posts: