!!! Help ..Mutating table problem

From: Joe <kauj_at_lfs.loral.com>
Date: 1997/01/09
Message-ID: <19970109.150401.086_at_lfs.loral.com>#1/1


[Quoted] [Quoted]     Any help is appreciated....
    We have two tables, table1 and table2.     Table1 has three fields,
      obj_name, obj_type , total_number
    Table2 has threee fields,
      obj_name, obj_type, obj_threshold_vlaue,

    obj_name and obj_type are two primary keys in table1 and table2 is child     table.

    We create a database trigger to update the total_number in table1, every     time the table2 was inserted or deleted a record in that obj_name and     obj_type. The trigger looks like this:

    Create or replace trigger name_trigger

     after
     INSERT or delete on table1
     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 errro and message said table "table2" is     mutating, trigger/function may not see it.

[Quoted]     Please any help will be appreciated...

    Please e-mail to (joe.kau_at_lmco.com) Received on Thu Jan 09 1997 - 00:00:00 CET

Original text of this message