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

Home -> Community -> Usenet -> c.d.o.server -> Re: Help with DECODE

Re: Help with DECODE

From: Radha Bala <radha.bala_at_amd.com>
Date: 1 May 1998 00:14:36 GMT
Message-ID: <01bd7497$3fdb9200$54215f8b@cisp467>


I don't think, you can do this using DECODE. You can do this using a SQL statement

SELECT id, type, 'faint'
FROM
astro
WHERE magnitude < 5.5
UNION
SELECT id,type,'very faint'
from astro
WHERE
magnitude >= 5.5 ;

Alistair Thomson <alistair.thomson_at_spinxcst.co.uk> wrote in article <35470AA9.9538B9F5_at_spinxcst.co.uk>...
> Hi
>
> I'm trying to get to grips with decode and am having difficulty in using
> expressions in decode. An example of the data is shown below:
>
> When I use decode like this
>
> select id, type, decode(magnitude,5.5,'faint',8.4,'very faint') from
> astro;
>
> I get the following:
>
> M33 Galaxy 5.7
> M34 Cluster 5.5 faint
> M39 Cluster 5.2
> M40 Double Star 8.4 very faint
>
> What I really want to do is say that everything < 5 is visible and >= 5
> is not visible. But when the decode looks like this I get an error:
>
> select id, type, decode(magnitude,<5.5,'faint',>=5.5,'very faint') from
> astro;
>
Received on Thu Apr 30 1998 - 19:14:36 CDT

Original text of this message

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