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

From: Inna Minder <arak_69_at_yahoo.com>
Date: Wed, 19 May 1999 10:25:32 -0400
Message-ID: <#6xjiLgo#GA.237_at_cppssbbsa03>


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 Wed May 19 1999 - 16:25:32 CEST

Original text of this message