Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> How to update child record in trigger of master_table?

How to update child record in trigger of master_table?

From: <corvax_kg_at_my-deja.com>
Date: Sat, 04 Nov 2000 07:39:17 GMT
Message-ID: <8u0ef6$s4v$1@nnrp1.deja.com>

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US