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 table

Re: mutating table

From: Sybrand Bakker <postmaster_at_sybrandb.demon.nl>
Date: Tue, 10 Aug 1999 21:58:09 +0200
Message-ID: <934315100.21187.0.pluto.d4ee154e@news.demon.nl>


This is because you are selecting from the table you are mutating: repair_equipment.
And you don't even need that: conceptually the join with repair_equipment is redundant as the foreign key of the repair_transactions table is available in :new.repair_trans_id.
Just remove the join, and it should be resolved.

Hth,

Sybrand Bakker, Oracle DBA

Gates <twofourblue_at_yahoo.com> wrote in message news:37B07D98.55C80B04_at_yahoo.com...
> I don't get it, I thought that I would get a mutating table error if I
> tried to update the table on which I created my trigger. In the
> following trigger I'm updating an different table yet I'm still getting
> the 'mutating table' error.
>
> Can anyone help?!?
>
> The trigger is on repair_equipment the update on repair_transaction.
>
> Thanx
> Gates
>
>
> CREATE OR REPLACE TRIGGER REPAIR1
> AFTER UPDATE OF returned_dt ON repair_equipment
> FOR EACH ROW
> DECLARE
> x NUMBER;
> BEGIN
> SELECT COUNT(*) INTO x FROM repair_transactions, repair_equipment
> WHERE repair_transactions.repair_trans_id = :new.repair_trans_id
> AND repair_transactions.repair_trans_id =
> repair_equipment.repair_trans_id
> AND Returned_Dt IS NULL;
> IF x = 0 THEN
> UPDATE repair_transactions SET closed_dt = SYSDATE
> WHERE repair_trans_id = :new.repair_trans_id;
> END IF;
> END;
> /
Received on Tue Aug 10 1999 - 14:58:09 CDT

Original text of this message

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