Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> change logs for any given table

change logs for any given table

From: I.S. Manager <ismgr_at_pctc.com>
Date: Fri, 30 Jun 2000 11:59:21 -0700
Message-Id: <10544.110988@fatcity.com>


I'd like to set up a change log or logs for certain tables. The change log would ideally record who, when, and what operation. Intuitively, it seemed that the best way would be to put a trigger in to handle it, something like this:

create table smoosh with fields barf1 and barf2

create table smooshlog with fields whodidit,whatdone,whendone,barf1,barf2

create triggers:

insert into smooshlog (select user,'insert',sysdate,* from smoosh where id
= thisone)

insert into smooshlog (select user,'update',sysdate,* from smoosh where id
= thisone)

That's really bad pseudo code but you get the idea. Unfortunately, it doesn't work. SQL doesn't like to specify '*' as one of the fields. On it's own is ok. I could of course specify each field individually, but that makes maintenance a bit of a nightmare.

I can imagine some pl/sql code that builds the field list dynamically at runtime from the system tables, and generates a dynamic sql statement, but I'm just not that good....

I may be going off in the wrong direction entirely. Are there any tried-and-true methods of doing this type of thing?

---
Dennis Taylor
---
The opinions expressed herein are mine. Get your own opinions!
Received on Fri Jun 30 2000 - 13:59:21 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US