Mutating Error [message #257398] |
Wed, 08 August 2007 04:40 |
sandhyaa
Messages: 79 Registered: February 2007
|
Member |
|
|
Hi,
I have two tables tableA and tableB.
Rows will be inserted into tableA (using some excel import utility) , i am inserting the same values to tableB inside the row-level trigger on tableA. Soon after the rows are inserted into tableB, I wanted it to be deleted from tableA.
I have written two triggers on tableA
CREATE OR REPLACE TRIGGER tableA_BRI BEFORE INSERT
ON tableA FOR EACH ROW
BEGIN
--Do some validations on the data that is inserted
END;
CREATE OR REPLACE TRIGGER tableA_ARI AFTER INSERT
ON tableA FOR EACH ROW
BEGIN
--sql to insert rows into tableB
END
If I place a delete tableA statement in the AFTER INSERT Trigger, it gives ORA-04091 mutating error. So how do I accomplish. The intention is that soon after rows are inserted into tableB, all rows in tableA should be deleted.
Thanks
Sandi
|
|
|
|
|
Re: Mutating Error [message #257453 is a reply to message #257431] |
Wed, 08 August 2007 07:07 |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
A couple more options:
Create A as an updatable view on table B.
Create table A as a Global Temporary table with a session duration, and have an After Insert trigger to insert rows into B.
The rows in A will go as soon as the session inserting into A ends.
|
|
|
|
|