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

Joe "Igor" Wilson

--- 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;


       
____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the 
tools to get online.
http://smallbusiness.yahoo.com/webhosting 

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

Reply via email to