0

I need to track data changes in DB and execute a trigger. The base records have a few associated (many-to-one) records in different tables. When any of the records (base or associated) are updated/inserted, the trigger has to be executed to perform some operations based on the base record and all associated records data.

When a new base record and all its associated records are inserted (created new records), is there any way to prevent the trigger from executing each time an associated record is inserted? I mean, is there a way to wait until all related data is stored and then run the trigger?

I can't guarantee that all insertions are performed in a single transaction and can't change the way the records are inserted. All I can do is add triggers and functions to existing DB.

I know that this question sounds naive and silly, but any crazy idea would be appreciated.

2
  • 1
    Are you looking for a "statement level" trigger? Commented Oct 23, 2018 at 11:08
  • I am looking for any kind of triggers. Actually, the question is not about which kind of trigger to use, but about how to achieve the purpose Commented Oct 23, 2018 at 11:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.