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: Shivanischal A <shivan_at_subexsystems.com>
Date: Thu, 23 Dec 2004 20:04:19 +0530
Message-ID: <001101c4e8fc$7d15f490$0c5410ac@subex>


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_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]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 Received on Thu Dec 23 2004 - 08:24:42 CST

Original text of this message

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