Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> How do you get Triggers and Constraints to "get along"?
Hi! I am having a dilemma with the firing order of triggers and constraints in an Oracle 7.x database, and was hoping someone could help. Here's the problem:
Actions performed in a BEFORE INSERT trigger execute without error, but the insert itself fails due to violation of an integrity constraint. One of the actions performed in the trigger is the update of a SEQUENCE number using the pseudo-column "nextval". So the sequence number increases in value, but the insert itself fails, and I'm left with non-consecutive sequence numbers.
Though updating a sequence within a trigger is a somewhat trivial example, the problem it reveals has much broader implications:
Any help or guidance would be greatly appreciated. TIA.