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 -> Trigger / mutating table

Trigger / mutating table

From: Juha Laiho <Juha.Laiho_at_iki.fi>
Date: Thu, 03 May 2007 09:37:03 GMT
Message-ID: <f1cac9$ilp$1@ichaos2.ichaos-int>


Hello,

I'm facing the ORA-04091 with a trigger I'm trying to write. After reading Google on the topic, I now understand that it is not allowed to have the trigger code refer to the table from which the trigger was activated.

So, I'm facing a design issue here, and would appreciate any help. Simplified, I'm having two tables, parent and subsidiary. Each row of subsidiary refers to a row in parent (many-to-one; there can be several subsidiary rows referring to a single parent row).

What I attempt to do with the trigger is to remove the parent row when there are no more subsidiary rows pointing to it (so, when subsidiary is removed, check which was the parent for this subsidiary, and are there any subsidiaries left with the same parent -- and if not, remove the parent along with the subsidiary).

This doesn't sound like anything extraordinary or uncommon -- but I don't seem to find the correct pattern for implementing this. Any pointers for solutions?

Thanks,

-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
Received on Thu May 03 2007 - 04:37:03 CDT

Original text of this message

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