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: Elias A. Kuzkin <dev_at_corvus.ru>
Date: Sat, 22 May 1999 11:39:21 +0400
Message-ID: <927358573.947153@mao.cityline.ru>

David Russell writes in message <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
>

Dear David, May I disagree also.

here is PL/SQL block:

[...SKIPPED...] if X=1 then
  select CUSTOMER_ID into A from TABLE_A where ID=22; else
  select CUSTOMER_ID*2 into A from TABLE_A where ID=22; end if;

[...SKIPPED...] here is SQL query:

select CUSTOMER_ID CID from TABLE_A
  where ID=22 and :X=1
  union
select CUSTOMER_ID*2 CID from TABLE_A
  where ID=22 and :X!=1;

Elias A. Kuzkin, Oracle Developer, Corvus International LLC, Moscow, Russian Federation,
dev_at_corvus.ru Received on Sat May 22 1999 - 02:39:21 CDT

Original text of this message

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