Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Deleting with Instead Trigger in Oracle 8i
Evening Howard,
put the Christmas Card list away !!!
>> I might need practice in reading triggers, but as I read your code,
it goes
>>'If inserting.... updating... elsif deleting...'
>> Strikes me that the updating part of the code gets executed
regardless of
>> what you're actually doing... but I could be wrong.
No, the OP was correct, he had 'if inserting ... elsif updating .... elsif deleting ... end if' which is fine. Obvioulsy the final elseif could be an else on the grounds of no more options though !
One thing to mention though, if you 'create or replace view' then any instead of triggers will be silently deleted, but grants to the view will remain - it's nice to be consistant :o)
I've done a test and it does indeed fail to delete but the reason while being quite simple, is a b*gg*r to track down :
you MUST use :OLD in a delte trigger and not :NEW. If you use :NEW then you get the message that n rows have been deleted, but they have not. Change the trigger to the following :
ELSIF DELETING THEN
DELETE FROM contractorsMV WHERE conIDMV = :OLD.conID; DELETE FROM contractors WHERE conID = :OLD.conID;
Cheers,
Norm.
Tel: 0113 289 6265 Fax: 0113 289 3146 URL: http://www.Lynx-FS.com -------------------------------------Received on Wed Apr 16 2003 - 03:35:26 CDT
![]() |
![]() |