Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Mutating tables?

Re: Mutating tables?

From: Connor McDonald <mcdonald.connor.cs_at_bhp.com.au>
Date: Thu, 25 Mar 1999 15:25:23 +0800
Message-ID: <36F9E4E2.51E8@bhp.com.au>


yliu_at_creighton.edu wrote:
>
> Hi All,
>
> I was wondering if someone could explain to me what the concept of
> mutating tables is. I looked up mutating tables in several of my manuals,
> but the concept is rather vague to me. If possible, could you please give
> me an example? How do you avoid this situation?
>
> Thank you very much for your help. Please reply to my e-mail address
> below.
>
> Yongge
> yliu_at_creighton.edu

(In very brief mode...)

If inside firing a row level trigger on a table X, you try to do things to table X itself, then this is a mutating problem...Since you are "in the middle of" insering/updating/deleting a row, the table is in an indeterminate state thus operations on the table (including read) will be prohibited.

The key to solving the problem is that it occurs in ROW level triggers. Rather than doing the work you need to do as each row level trigger fires, you store enough information inside a PL/SQL table such that you can then use the info inside this PL/SQL table to do the work in a STATEMENT AFTER trigger...

You are deferring the actions you needed to take at ROW level until STATEMENT level to avoid the mutating problem.

HTH
--



Connor McDonald
BHP Information Technology
Perth, Western Australia
"Never wrestle a pig - you both get dirty and the pig likes it..." Received on Thu Mar 25 1999 - 01:25:23 CST

Original text of this message

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