Re: Mutating table with old and new ... only
Date: Wed, 27 Aug 2008 16:32:06 -0700
Message-ID: <1219879914.548830@bubbleator.drizzle.com>
Dirk Wendt 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.
What you describe will not cause a mutating table error.
Go to Morgan's Library at www.psoug.org and click on Table Triggers.
Run the demo that creates the error to learn what creates it and how to avoid it.
Essentially what must happen to create the error is that the trigger must query the table on which DML is being performed.
-- Daniel A. Morgan Oracle Ace Director & Instructor University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Wed Aug 27 2008 - 18:32:06 CDT