🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #11197

Re: Avoid recursive trigger

#11197
From: Martijn Tonies
Date: Tue, 10 Dec 2002 13:36
36 lines
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."
Technical Details
Message-ID: <3df5ed1f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3df5e619@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114a0e,744a7a3b4fe7b4d5
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-12-10 05:39:23 PST
From: "Martijn Tonies" <m.tonies@upscene_remove.com>
Newsgroups: borland.public.interbase.sql
References: <3df5e619@newsgroups.borland.com>
Subject: Re: Avoid recursive trigger
Date: Tue, 10 Dec 2002 14:36:10 +0100
Lines: 38
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 212.238.179.102
Message-ID: <3df5ed1f$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1039527199 212.238.179.102 (10 Dec 2002 05:33:19 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail