Database Trigger on Inserting Record!

From: YyWong <yywong_at_math.hkbu.edu.hk>
Date: 1997/12/09
Message-ID: <66jegs$d10$1_at_power42t.hkbu.edu.hk>#1/1


[Quoted] I am new in writing database trigger. Recently, I want to write a trigger to insert a new record into another table, says B, after a new record is inserted into a table, says A.

The trigger's content is:

CREATE OR REPLACE TRIGGER b_insert
AFTER INSERT
ON A
FOR EACH ROW
BEGIN
  INSERT INTO B
(b_code, b_num)

    VALUES
(:new.grp_code, 0);

END; However, an error always occurs:

ORA-04091: table TEST.A is mutating, trigger/function may not see it
ORA-06512: at "TEST.B_INSERT", line 4
ORA-04088: error during execution of trigger 'TEST.B_INSERT'

Am I do something wrong on :new?
Or how can I handle the newly inserted record in A and insert any column into B?

Thanks! Received on Tue Dec 09 1997 - 00:00:00 CET

Original text of this message