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: range checking ??? URGENT

RE: range checking ??? URGENT

From: Jacques Kilchoer <Jacques.Kilchoer_at_quest.com>
Date: Wed, 14 Nov 2001 15:06:56 -0800
Message-ID: <F001.003C529D.20011114144525@fatcity.com>

> -----Original Message----- 
> From: Leslie Lu [mailto:leslie_y_lu_at_yahoo.com] 
> 
> Can decode work on a range, like if Code is > 100 and 
> < 200, then name is A; if code>200 and code<300, then 
> name is B; .... I have about 20 ranges to check.  If 
> decode cannot handle that, what's an easy way to do 
> that? 



P.S. I forgot to mention the case statement if you have Oracle 8.1 example:
LQS> select n,

  2     case when n < 100 then '< 100'
  3          when n >= 100 and n < 200 then '100 <= n < 200'
  4          when n >= 200 and n < 800 then '200 <= n < 800'
  5          when n >= 800 and n < 1000 then '800 <= n < 1000'
  6     end as n_description
  7  from t
  8  where mod (n, 50) = 0 ;


         N N_DESCRIPTION
---------- ---------------

        50 < 100

       100 100 <= n < 200
       150 100 <= n < 200
       200 200 <= n < 800
       250 200 <= n < 800
       300 200 <= n < 800
       350 200 <= n < 800
       400 200 <= n < 800
       450 200 <= n < 800
       500 200 <= n < 800
       550 200 <= n < 800
       600 200 <= n < 800
       650 200 <= n < 800
       700 200 <= n < 800
       750 200 <= n < 800
       800 800 <= n < 1000
       850 800 <= n < 1000
       900 800 <= n < 1000
       950 800 <= n < 1000

19 ligne(s) sélectionnée(s). Received on Wed Nov 14 2001 - 17:06:56 CST

Original text of this message

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