Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: tigger to store info on change
jriker1_at_yahoo.com (John) wrote in message news:<e6bb5a8d.0209190302.1dedf749_at_posting.google.com>...
> I am working on some audit trail stuff, and was requested to do the
> following:
>
> 1. When a new entry is placed in any table, log that it's an insert,
> the column names in the table that the insert is on, and the values
> being put in. Log this to a table say called AUDIT.
>
> 2. When an update is done, log that it's an update, the column names
> in the table that is having the data updated, and the ORIGINAL values
> before the update to the AUDIT table.
>
> 3. Same with deleting.
>
> Now I think in step two it should log the new value since the original
> one is already in the audit log, but it is felt by others that they
> can look at the actual table the data is stored in and retrieve the
> current value, so the original one is more relevant. With that said,
> does anyone have a sample of a trigger I can put on all my tables to
> accomplish the above?
>
> Figured I would have the AUDIT table with a auto-increment primary
> key, a column that says if it was an insert/update/delete, one to
> store the column names and data(or maybe two seperate for this part).
> Any help would be appreciated in accomplishing this. Thanks.
>
> JR
Visit http://tahiti.oracle.com online docs. You will find a detailed description and sample code on Triggers and lot's of other Oracle related stuff.
/Rauf Sarwar Received on Thu Sep 19 2002 - 12:01:36 CDT
![]() |
![]() |