Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> How to update child record in trigger of master_table?
When I am deleting a record from master table I have to update record
(s) in child table. I try to update child record in trigger BEFORE
DELETE ON master_table FOR EACH ROW. In the body of that trigger I have
to set FOREIGN KEY field value in child_table to NULL. But when trigger
fired oracle error is appeared "Table is mutating...".
The same situation has been discussed in this forum, but discussed
situation was about INSERTing into master_table...
Help, please.
Thanks in Advance.
Here are details:
create or replace trigger T_master_set_null
before delete on t_master
for each row
declare
begin
update t_child
set id_master = null
where id_master = :old.id;
end T_master_null;
-- And full text of error message is: ORA-04091: table T_MASTER is mutating, trigger.function may not see it. ORA-06512: at "T_MASTER_SET_NULL", line 6 ORA-04088: error during execution of trigger 'T_MASER_SET_NULL' Sent via Deja.com http://www.deja.com/ Before you buy.Received on Sat Nov 04 2000 - 01:39:17 CST