We are auditing a table TRANSACTIONS that inserts a row in HISTORY_TRANSACTIONS when specific columns are changed. These inserts happen through a number of triggers defined on TRANSACTIONS table. Is it possible to find out which trigger inserted a specific record in HISTORY_TRANSACTIONS ? (seems impossible, but I wanted to confirm that no system tables could achieve this as well?)


You are correct in your assumption – there is nothing done at the database level that would track the source of a row. You would need to modify your history table definition and trigger logic to add this kind of tracking.

| improve this answer | |
  • That being said...I think there is some audit logging you can turn on in DB2 but I do not know to what extent it logs. I believe that by default this is off. – Chris Aldrich Feb 15 '13 at 21:42
  • Auditing (at least on DB2 for LUW) would be able to track the actual insert statement, but because triggers are compiled in to the actual insert statement it would not be possible to identify which trigger caused the particular action. – Ian Bjorhovde Feb 19 '13 at 6:27
  • that's a bummer.... – Chris Aldrich Feb 19 '13 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.