Re: Mutating problem

From: Stephen Lappin <SL_at_rtel.demon.co.uk>
Date: Mon, 27 Mar 1995 13:16:17 +0000
Message-ID: <796310177snz_at_rtel.demon.co.uk>


In article <3kpo04$935_at_due.unit.no>

           toredale_at_pvv.unit.no "Bj|rn Tore Dale" writes:

> I have two tables A and B.
> Table A has a field SUMWGT and STATUS and ARTICLE.
> Table B has a field WGT and LINENO and ARTICLE.
> I would like an Update/Delete Trigger on table B to
> compute the SUM(WGT) for all rows,except the one being updated/deleted
> with the given ARTICLE
> (key on table A is ARTICLE, key on table B is ARTICLE+LINENO)
> and Update the row on table A for this given article with
> a new STATUS, which depend on the new sum.
> The problem is that I get the Oracle error "Table is Mutating",
> even if I make sure that the Where-clause doesn't select
> the row that is being updated/deleted (the error does not, of course,
> occur when inserting).
>
> Can anybody help me out on this one?
> I don't want to call a stored procedure from the client-side to
> perform the Update on table A. I would like to handle all this
> in triggers.
>
> Bjorn T. Dale
> toredale_at_flipper.pvv.unit.no
>

Try creating a view for Table B (SELECT * FROM B). Perform any updates or deletes via the table, but use the view within your trigger.

I have used this and it works!

Slainte mhath

-- 
Stephen Lappin

+-----------------+
| +-------------+ |  Real Time Engineering Ltd.
| |  Real Time  | |  Capital House
| +-------------+ |  20 Park Circus
| Engineering Ltd |  Glasgow G3 6BE         Tel: +44 (0)141 332 9400
+-----------------+  Scotland U.K.          Fax: +44 (0)141 331 2509
Received on Mon Mar 27 1995 - 15:16:17 CEST

Original text of this message