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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Need help with SQL Statement

Re: Need help with SQL Statement

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: 2000/07/19
Message-ID: <964036946.23591.2.pluto.d4ee154e@news.demon.nl>#1/1

Just nest your decodes
decode(t1.field, null, decode(t2.field,null,t3.field, t2.field))

Hth,

Sybrand Bakker, Oracle DBA

"Elliott Mehrbach" <elliottj_at_ispchannel.com> wrote in message news:fEmd5.2627$0H4.1957347_at_news1.onlynews.com...
> I am trying to duplicate a select statement that is currently in use in
> MS-Sql Server:
>
> select T1.PKEY as T1_PrimaryKey,
> T2.PKEY as T2.PrimaryKey,
> T3.PKEY as T3.PrimaryKey,
> FldValue =
> CASE
> WHEN T1.FIELD1 is not null THEN T1.FIELD1
> WHEN T2.FIELD1 is not null THEN T2.FIELD1
> WHEN T3.FIELD1 is not null THEN T3.FIELD1
> END
> from TABLE1 T1,
> TABLE2 T2,
> TABLE3 T3
> where T2.FKEY = T1.PKEY
> and T3.FKEY = T2.PKEY
>
> I am using CASE. In Oracle I usually use DECODE. But I do not see how to
 do
> that in this case. Any suggestions would be greatly appreciated.
>
> Elliott
>
>
Received on Wed Jul 19 2000 - 00:00:00 CDT

Original text of this message

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