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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Can you use "If..Then" logic in SQL?

Re: Can you use "If..Then" logic in SQL?

From: fungi <fungi_at_starcs.on.ca>
Date: Tue, 8 Jun 1999 04:50:03 -0400
Message-ID: <eBK0ktYs#GA.259@cppssbbsa02.microsoft.com>


I was under the impression that was an Oracle-only SQL92 code, and not available anywhere else....

fungi

Adrian Biffen <adrian_biffen_at_playstation.sony.com> wrote in message news:375C0213.7DFA967A_at_playstation.sony.com...
> You can also use the decode function:
> select decode(column_a, condition, value if true, value if false)
> from table_1;
>
> Cheers
> Adrian
>
>
> Inna Minder wrote:
>
> > This is not Exactly correct. You can use "Case Then Else" statment.
> >
> > SELECT 'Something' =
> > CASE type
> > WHEN 'One' THEN '20'
> > WHEN 'Two' THEN '21'
> > WHEN 'Three' THEN '22'
> > WHEN 'Four' THEN '23'
> > WHEN 'Five' THEN '24'
> > ELSE '100'
> > END,
> > SomethingElse, SomethingElse2
> > FROM table
> > WHERE .....
> > Thank's Anton Rakushkin
> >
> > David Russell <dbruce_at_kreative.net> wrote in message
> > news:3741f9fb.19123628_at_news...
> > >
> > > SQL is not "procedural"... that's why PL/SQL was developed. You can
> > > use some of the report writing features to get nested reports; but,
> > > for true if/then/else logic go elsewhere: PL/SQL, 3GL, Java...
> > >
> > > David Russell
> > >
>
Received on Tue Jun 08 1999 - 03:50:03 CDT

Original text of this message

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