Re: trigger error - mutating table???
Date: Mon, 17 Aug 1998 00:47:51 +0100
Message-ID: <#zkEGbWy9GA.290_at_ntawwabp.compuserve.com>
There is a discussion about the mutating table problem in the
SERVER APPLICATION DEVELOPER'S GUIDE
In short terms:
You can't read or write to the triggered table in record level trigger. A
possible workaround is to save values in package variables and read/modify
the triggered table in the statement level trigger!
Greetings from Germany
reinhard
Vanessa McCauley schrieb in Nachricht
<6r0286$hqu$1_at_oak.prod.itd.earthlink.net>...
>I am trying to construct a very simple trigger AFTER INSERT of a parent
>record, to populate the child record's FK field.....
>On INSERT to FACILITIES, the application first generates a random surrogate
>PK in the REGISTRY table, then returns that value to act as the
>FACILITIES.PK value as well. All good.
>So, the trigger takes that PK value from FACILITIES, and kicks it back to
>the REGISTRY record's FK to FACILITIES. This has to happen AFTER INSERT,
>since the REGISTRY record is formally a child of the FACILITIES record.
>Hence:
>CREATE TRIGGER.....
>AFTER INSERT ON F_FACILITIES
>BEGIN
>INSERT INTO REGISTRY (FKEY_FACILITIES)
>VALUES (:NEW.PKEY)
>WHERE REGISTRY.PKEY = :NEW.PKEY;
>END;
>The error message states "f_facilities is mutating, the trigger may not see
>it..."
>I cannot find a discussion of mutating tables (or even a definition) in any
>on-line ORACLE books, O'Reilly press books, or Oracle press books that I
>have. Any ideas?
>Thanks!
>-Veeb
>
>
>
Received on Mon Aug 17 1998 - 01:47:51 CEST