Re: Mutating table with old and new ... only

From: joel garry <joel-garry_at_home.com>
Date: Wed, 27 Aug 2008 16:44:01 -0700 (PDT)
Message-ID: <d32439a8-05e9-468a-97cc-7f5787bd0b02@a8g2000prf.googlegroups.com>


On Aug 27, 12:07 pm, "Dirk Wendt" <i..._at_dpcw.de> wrote:
> Hello,
>
> I have been told that something like:
>
> create trigger triggername
> before update of ROW on TABLE
> for each row
> when (old.ROW = a and new.ROW = b)
> begin
>   :new.ROW := :old.ROW;
>   .... message "a could not be updated with b"
> end;
> /
>
> would cause the mutating table error. Certainly I have tried it out and did
> not receive this error. From my knowledge
> new and old are just "copies" and since I am not accessing the table/row
> which is going to be updated/or not an
> mutating error could not happen in this context, right? In general I wonder
> if the trigger above could be used or if it
> is better to have such logic somewhere else?
>
> Thanks much in advance for you help.
>
> Best regards,
> Dirk.

I think you would get it once you add a relational integrity constraint or if someone else is updating the table. See http://asktom.oracle.com/tkyte/Mutate/index.html (which refers to the docs http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg13trg.htm#786 ) and search on the term mutating at asktom.oracle.com for the many variants of this.

You have to remember when you try things out to try the things that will cause the problem. This can be more difficult than some people expect, given a complicated system.

jg

--
@home.com is bogus.
Wormmmmmsss innnnn Spaaaaaaacccce. http://news.bbc.co.uk/1/hi/technology/7583805.stm
Received on Wed Aug 27 2008 - 18:44:01 CDT

Original text of this message