Re: Pre Delete Triggers

From: Joost Ouwerkerk <owrkrj_at_mailhub.sickkids.on.ca>
Date: Mon, 04 May 1998 19:09:31 GMT
Message-ID: <354e10de.16472666_at_resunix.sickkids.on.ca>


[Quoted] On Mon, 04 May 1998 12:23:11 -0600, meyer_b_at_rocketmail.com wrote:

>I want to create a pre delete trigger that will copy some of the columns in
>the row to be deleted into another table. I've got no problem with inserting
>into the new table, but how do I reference the values in the current row to be
>deleted?

[Quoted] Preface your column names with :old or :new.

For example:

CREATE OR REPLACE TRIGGER trig_audit_emp_hist BEFORE DELETE ON employee
FOR EACH ROW
BEGIN
 INSERT INTO audit_emp_history (user_name, timestamp, id,

                             old_last_name, new_last_name)
 VALUES (user, sysdate, :old.id, :old.last_name, :new.last_name);

END trigin_audit_emp_hist; Received on Mon May 04 1998 - 21:09:31 CEST

Original text of this message