Yuriy Martsynovskyy
<[EMAIL PROTECTED]> wrote:
Is it possible to write a conditional SQL code like this? CASE
expression does not seem to work here

IF (exists (Select * from tab1))
THEN
Insert into tab2 select * from tab3
ELSE
Insert into tab2 select * from tab4
ENDIF;

Something like this is best done in host application's code. But if you insist:

insert into tab2
select * from tab3 where exists (select * from tab1)
union all
select * from tab4 where not exists (select * from tab1);

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to