Subject Re: How to avoid Triggers' infinite loop?
Author Juan Jose Ochoa
Just make a condition to terminate the loop.

In table A:

if (not exists(select 1 from tableB where
field1=new.field1 and field2=new.field2 and ...)) then

update tableB
set field1=new.field1,
field2=new.field2,...

In table B:

if (not exists(select 1 from tableA where
field1=new.field1 and field2=new.field2 and ...)) then

update tableA
set field1=new.field1,
field2=new.field2,...


HTH

--- In firebird-support@yahoogroups.com, Anderson Miranda
<anderson@b...> wrote:
> Hi there,
>
> I have a simple scheme like this:
>
> TABLE_A => After update, update TABLE_B
> TABLE_B => After update, update TABLE_A
>
> Problem is, if I do such thing using triggers on both tables, I would
> ran into an infinite loop between triggers.
>
> My question is: How could I avoid the infinite loop and still achieve
> the above mentioned scheme?
>
> Regards,
> Anderson