Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Help!!! Mutating table error !!!!!!
We created two tables, table1 and table2, and table1 is a parent table of table2.
Table1 has three fileds,
obj_name, obj_type and total_number
Table2 has three fields
obj_name, obj_type and obj_values
We also created a database trigger which will update the total_number in table1 every time the record in table2 was deleted or inserted. The trigger look like this: (it may have some buggs )
Create or replace trigger tri_name
after INSERT or DELETE on table2 for each row declare total number; begin select count(*) into total from table2 where obj_name = :old.obj_name group by obj_name; update table1 set total_number = total where obj_name = :old.obj_name; end; We are getting ORA-04091 table table2 is mutating, trigger/function may not see it. How can we write a trigger to update table1 when the total number of the obj is changed. Please e-mail to joe.kau_at_lmco.com Any help will be appreciated.....Received on Tue Jan 07 1997 - 00:00:00 CST