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 -> Re: Mutating tables, Constraints, and triggers

Re: Mutating tables, Constraints, and triggers

From: Frances Edelstein <rbs_at_nyic.com>
Date: 1996/12/12
Message-ID: <MPLANET.32b0296arbs9896a0@snews.zippo.com>#1/1

In article <32AF238D.14B4_at_stanleyassoc.com>, nks_at_stanleyassoc.com says...
> Hi all!
>
> We are having a mutating table problem and we are wondering if anyone
> has any advice for us.
>
> We have a database in which foreign key constraints are defined for our
> relationships. Upon insertion into a parent table we have an After
> Insert trigger for each row which performs an insert into child tables.
> At the time we attempt to perform an insert into the parent table we
> receive an ORA-4091 'parent table is mutating ' error on the first
>

The usual way is to define PL/SQL tables in a package specification. In your after insert, for each row trigger, call a procedure that will place the information you need to create the child row into those tables. In your after insert for each statement (not for each row), call another procedure to cycle through the tables and use that info to create the child rows. Watch out for circular logic in the child table's triggers!

Fran
rbs@nyic.com http://www.rbsbooks.com Received on Thu Dec 12 1996 - 00:00:00 CST

Original text of this message

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