Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> change logs for any given table
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