Folks,
Perhaps you can help....hell I'm sure you can!
I want to monitor for changes in a table and migrate the OLD. record to
audit table.
Is there an elegant or generic way to do this so I can use across multiple
tables with little change.
E.g.
IF TG_OP = 'UPDATE' THEN INSERT INTO cust_hist ( col1, col2, col3, col4 ) VALUES ( OLD.col1,
OLD.col2, OLD.col4 ) ;
END IF ;
This hardly seems scalable for a table with 50-100 columns.
I'm thinking that perhaps there is a way to use RECORD or some such variable
to be able to do something like:
INSERT INTO cust_hist ( OLD.* ) ;
I guess something like this might also work:
INSERT INTO cust_hist SELECT * FROM cust WHERE cust_id = OLD.cust_id ;
But it strikes me as very very bad from a performance standpoint.
Would love to hear your thoughts.
-D
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.574 / Virus Database: 364 - Release Date: 1/29/2004