begin
  select 'y' into dummy
   where table3.column = table1.column;
  insert into table3 blah blah;
  exception 
  when no_data_found then
   begin
     select 'y' into dummy
     where table2.column = table1.column;
     insert into table2 blah blah;
   exception
    when no_data_found then
     do reqd tasks;
    when others then 
     blah blah;
    end ;
   when others then
     do reqd tasks;
end;

HTH
GovindanK

On Mon, 10 Nov 2003 06:54:25 -0800, [EMAIL PROTECTED] said:
> Hallo,
> 
> I would like to do the following with an sql( pl/sql) statement.
> 
> I have table1 and table2 andtable3.
> 
> I want to check whether field1 in table1 exists in table3. If so then I
> want an insert statement to be run...insert into table3.....
>  If it doesnt find that value then th escript will go to table2 and check
>  if the vaules exists in that table, if it finds it then I want another
>  insert statement to be run.
> 
> Please help me with an easy example, i dont know if this is so simply but
> I cantget it right though.
> 
> 
> Thanks
> 
> 
> Roland
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> -- 
> Author: 
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
> San Diego, California        -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).

-- 
http://www.fastmail.fm - Email service worth paying for. Try it for free
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: GKatteri
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to