Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Triggers seem to be compiled only randomly
As to multiple triggers
1 Oracle doesn't guarantee the order of the triggers. This may be
irrelevant in your case, but you'd better not create
F(ear)U(ncertainty) and D(oubt) in your system.
2 There is a concern with respect to this design. You state the trigger
concerns a cascading update. I would like to be sure whether the
cascading update fully succeeded or not. In your case either trigger
can fail. No harm done when the first trigger fails, but Oracle won't
roll back the results of the first trigger if the second fails (as
Oracle has *statement* level rollback by default). So in combination
with the first issue, you can never be sure which part failed, when you
have a failure.
So the entire thing would need to go into one trigger like this
CREATE TRIGGER SABISDAT.itzVerarbeitungsSchlUC0 after update of id -- I deliberately changed this
ON SABISDAT.tzVerarbeitungsSchl ^^^^^^^^^
UPDATE
tbBuchungsVorlagen
SET
cIDVerarb = :NEW.cID
WHERE
cIDVerarb = :OLD.cID;
exception
when others then
rollback; -- roll back the transaction
raise; -- reraise the error to end-user
END;
The trigger needs to be an after update trigger, because the master
update may fail.
The triggers needs to fire only when the id changed. In that case you
don't need have to test anymore.
Hth
-- Sybrand Bakker Senior Oracle DBAReceived on Wed Aug 03 2005 - 07:48:21 CDT
![]() |
![]() |