Re: How to synchronize two tables using update triggers?

From: DanHW <danhw_at_aol.com>
Date: 1998/03/22
Message-ID: <1998032206534900.BAA16219_at_ladder03.news.aol.com>#1/1


>Hi there,
>
>I ran into the problem of synchronizing two tables, say table A and
>table B using update triggers. What I hope to see is once a row in table
>A is updated, the correspdoning row in table B is updated right away to
>reflect the change, and vice versa. My first thought was to implement an
>AFTER update row trigger on both tables, but I realize afterwards that
>it will end up with recursive loop, i.e. table A trigger fires table B
>trigger which fires table A trigger again... Does anybody happens to
>know any work around with this problem, or you have better way to
>synchronize two tables without using triggers?
>
>Thanks a lot in advance.
>
>-- Lu :)

If you create a package whose sole purpose it to hold a variable, then you can set the variable in the first trigger (to say it should fire), and the 2nd trigger can see it and decide not to fire. Likewise, if trigger 2 starts the process, set the variable so only trigger 2 fires and trigger 1 does not. You will might also need before and after statement triggers to ensure it is in the correct state. FYI, package variables stick around for the life of a session.

Dan Received on Sun Mar 22 1998 - 00:00:00 CET

Original text of this message