|
-
You would write an AFTER INSERT, UPDATE, DELETE trigger. Inside this trigger, you would inspect the :new and :old values of each field to see if they have changed. If they have changed, you would insert the appropriate information into your audit table.
I did something similar to this before. Basically, we had a table TABLE_A and we wanted a history of what changes were made to the data. We created another table AUDIT_TABLE_A that had the same structure as TABLE_A, but contained three additional fields, USERNAME, AUDIT_TIMESTAMP, OPERATION. When an insert happened, we captured the :new values (1 row in AUDIT_TABLE_A). When a delete happened, we captured the :old values (1 row in AUDIT_TABLE_A). When an update happened, we captured both the :new and :old values (2 rows in AUDIT_TABLE_A). AUDIT_TABLE_A was partitioned by day and we kept a rolling window of 30 days in AUDIT_TABLE_A.
Jeff Hunter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|