Update before trgger not getting invoked [message #184817] |
Fri, 28 July 2006 03:04 |
rakshita.gupta
Messages: 1 Registered: July 2006
|
Junior Member |
|
|
I am working on an application that requires the following 4 triggers on the same table say A:-
1.) One is before insert on A
2.) One is before insert or update of A
3.) One is after insert or update of A
4.) One is before Update of A
Triggers 1,2,4 are row level triggers and trigger 3 is statement level trigger.
I want to invoke the last trigger i.e. "before update of A" on the modify selection using a frontend GUI. However, the 3rd trigger which is "after insert or update of A" is getting invoked currently.
This is defeating my purpose of executing some vital data checks before the update of A.
I anyone can help me pls. re.
Thanking you in advance.
Regards,
Rakshita Gupta
|
|
|
Re: Update before trgger not getting invoked [message #184820 is a reply to message #184817] |
Fri, 28 July 2006 03:08 |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
Are you saying that trigger 4 is not getting fired at all? That would be very odd (and rather unbelievable - much more likely that there is a problem with the code in 4 that means it isn't doing what you think)
you should note that triggers 2 and 4 will both fire for an update of A, and there is no guarantee which order they will fire in. You can replace triggers 1,2,4 with 1 trigger:
CREATE OR REPLACE TRIGGER trg_name
BEFORE INSERT OR UPDATE ON A
FOR EACH ROW
BEGIN
IF INSERTING THEN
<code>
END IF;
IF UPDATING THEN
<code>
END IF;
END;
|
|
|