Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Can you use "If..Then" logic in SQL?
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
![]() |
![]() |