Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: If EXISTS before insert clause
JPike wrote:
> I suppose that will work but it is a pretty big script file and adding
> that to every insert would be a pain. Also there are some table
> creations, alters, update and stuff falling under the contraints of the
> if, so wrapping the whole block in a big IF would be easiest if it's
> somehow possible.
>
> Somehow though I am think easy and Oracle don't belong in the same
> sentence.
>
> Jim
>
Please forgive because my PL/SQL is a little rusty.
Perhaps something like:
declare
l_prd_uid number default null; l_test is cursor for select prd_uid from wst_prd where prd_uid = 502;
open cursor l_test; fetch l_test into l_prd_uid; close cursor l_test; if l_prd_uid is not null then insert into WST_PFD( pfg_uid, obj_uid ) values ( '14014', 'GRP_VIEW_RSK' ); /***********************************************************/ /* Do other stuff here. Make sure you handle execeptions. */ /***********************************************************/ end if;