Thread View: borland.public.interbase.sql
2 messages
2 total messages
Started by Emi Garcia
Tue, 10 Dec 2002 13:00
Avoid recursive trigger
Author: Emi Garcia
Date: Tue, 10 Dec 2002 13:00
Date: Tue, 10 Dec 2002 13:00
8 lines
1277 bytes
1277 bytes
I need to made a trigger that updates a set of records when a record is updated. The problem is that the trigger only must run when the first update statement is executed. The update statements inside the body trigger must not fire the trigger. I try to alter trigger trigger to inactive in the first line of the tigger code but I get an error from interbase . Someone can help me?
Re: Avoid recursive trigger
Author: Martijn Tonies
Date: Tue, 10 Dec 2002 13:36
Date: Tue, 10 Dec 2002 13:36
36 lines
1991 bytes
1991 bytes
Hi,
> I need to made a trigger that updates a set of records when a record is
> updated.
> The problem is that the trigger only must run when the first update
> statement is executed.
So you are updating the table that the trigger is on? Pff, the only way I
can think of is to update some dummy column to "UPDATE_BY_TRIGGER"
and in your trigger code do something like:
if (new.mydummycolumn <> 'UPDATE_BY_TRIGGER')
then begin
// do my stuff
end
> The update statements inside the body trigger must not fire the trigger.
> I try to alter trigger trigger to inactive in the first line of the tigger
> code but I get an error from interbase .
Of course - it's DDL, which isn't allowed in procedures or triggers.
--
With regards,
Martijn Tonies
InterBase Workbench - the developer tool for InterBase & Firebird
Firebird Workbench - the developer tool for Firebird
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads