Subject | Re: [firebird-support] Re: How to avoid Triggers' infinite loop? |
---|---|
Author | Anderson Miranda |
Post date | 2005-08-30T21:28:45Z |
Juan Jose Ochoa escreveu:
multiple registries in tableB and tableB updates only one registry at a
time in tableA ?..
Like this:
TABLE_A
FIELD1_KEY
DATAFIELD
TABLE_B
FIELD1_KEY
FIELD2_FKEY (References TABLE_A.FIELD1_KEY)
DATAFIELD
It's like, in a real example, TABLE_A stores floor data of an entire
build, and TABLE_B stores room data for each floor of that build...
Well, maybe I'm just asking something dumb but, this infinite loop
thingy is just driving me mad!..
Thnx for all the help and info, thou!
Best Regards,
Anderson
> Just make a condition to terminate the loop.Hmmm... Yeah, this is also a fine approach but, what if tableA updates
>
> 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
multiple registries in tableB and tableB updates only one registry at a
time in tableA ?..
Like this:
TABLE_A
FIELD1_KEY
DATAFIELD
TABLE_B
FIELD1_KEY
FIELD2_FKEY (References TABLE_A.FIELD1_KEY)
DATAFIELD
It's like, in a real example, TABLE_A stores floor data of an entire
build, and TABLE_B stores room data for each floor of that build...
Well, maybe I'm just asking something dumb but, this infinite loop
thingy is just driving me mad!..
Thnx for all the help and info, thou!
Best Regards,
Anderson