Trigger novice needs help
From: Chuck Hamilton <chuckh_at_ix.netcom.com>
Date: 1995/07/28
Message-ID: <3vb0en$7vn_at_ixnews3.ix.netcom.com>#1/1
END; Received on Fri Jul 28 1995 - 00:00:00 CEST
Date: 1995/07/28
Message-ID: <3vb0en$7vn_at_ixnews3.ix.netcom.com>#1/1
I'm trying to create my first database trigger and am having a little trouble. Here's what I want to do. When someone tries to delete a row from table1, I want the row first to be inserted into table2 before it gets deleted. Sounds simple enough. But when my trigger fires I get the following error...
DELETE FROM table1 WHERE provider = '31041'
*
ERROR at line 1:
ORA-04091: table CHA.TABLE1 is mutating, trigger/function may not see
it
ORA-06512: at line 2
ORA-04088: error during execution of trigger 'CHA.TRIGGER1'
Here's what my trigger looks like...
CREATE OR REPLACE TRIGGER trigger1
BEFORE DELETE ON table1
FOR EACH ROW
BEGIN
INSERT INTO table2 (SELECT * FROM table1 WHERE provider = :old.provider);
END; Received on Fri Jul 28 1995 - 00:00:00 CEST