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

Home -> Community -> Usenet -> c.d.o.server -> Trigger :old and :new column values

Trigger :old and :new column values

From: <Imagecodedata_at_netscape.net>
Date: Wed, 24 Nov 1999 10:17:09 GMT
Message-ID: <81gdv3$gpk$1@nnrp1.deja.com>


Please bear with me, my question needs a bit of explanation !

I'm trying to write some "auditing" code in a TRIGGER which saves old and new values of particular columns on particular tables I'm interested in.......

I've got some code like this.....

    CURSOR c1(pType VARCHAR2

             )
     IS

    SELECT COLUMNNAME FROM INTERESTS
    WHERE INTERESTS.TYPE = pType;

which is followed a bit further on by....

        FOR changes_rec IN c1(sType) LOOP

	    INSERT INTO AUDIT_CHANGES
 	    VALUES(
		AUDIT_CHANGES_SEQ.NEXTVAL,
		sType,
		changes_rec.COLUMNNAME,

*:old.ColumnName*, <--- Problem is here !
*:new.ColumnName*, <---
); END LOOP;

For each columnname returned in the c1 "INTERESTS" table query I want to save the OLD and NEW values in my AUDIT_CHANGES table,

How do I reference the column in the :old and :new records when I've only got the column's name in <changes_rec.ColumnName> ?! I figure I need some way of "Evaluating" :old.(changes_rec.ColumnName) but I can't find one....

Any suggestions ??

Dave

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Nov 24 1999 - 04:17:09 CST

Original text of this message

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