Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Query to display data changes for audit purposes. Like who changed & what changed etc...

dprogrammerxAug 7 2013 — edited Aug 12 2013

Dear Folks,

I've to write a query that tracks changes made to data by certain users. The query will be written for a known set of tables but each table has a different number of columns. The query needs to display which values have changed, what was the previous value and what's the new value. For example: TableA has following data:

Item IDPriceItem DescCreated_byUpdated_byCreated_dateUpdated_dateVersion_no
1        $1.49  Lemon Teaabcuserabcuser2013-08-07 11:07:00am             2013-08-07 11:07:00am             0
1$       1.50 Lemon Teaabcuserxyzuser2013-08-07 11:07:00am             2013-08-07 11:15:00am             1
1$       1.50Lemon Tea China abcuserghiuser2013-08-07 11:07:00am             2013-08-07 11:30:00am             2
There were two changes, a price change and a description change by two different users during two different times. Hence the query
should fetch both of the rows.
Similiary there are few other tables that contain more number of columns that could be changed by users. The parameter to query will be the name of the table and the date.
I hope this is quite simple explanation about my issue but if something is not clear please let me know.
Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 9 2013
Added on Aug 7 2013
13 comments
3,375 views