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

Home -> Community -> Usenet -> c.d.o.server -> Re: mutating table error message..

Re: mutating table error message..

From: Muralidhar Prabhakaran <muralip_at_earthlink.net>
Date: 2000/04/22
Message-ID: <uG6M4.72914$q67.1226750@newsread2.prod.itd.earthlink.net>#1/1

Refer to the PL/SQL developers guide. It gives a very good way of getting around mutating table error.
Igor Lyulkin <IgorLyulkin_at_qsius.com> wrote in message news:3900782c_at_news.eclipse.net...
> Hi there!
> I wander if anyone knows how to get around this '..mutating table..' error
> message.
> I'm writing a trigger , that fires upon update of a table_1.
> This trigger does update of a table_2 ,based on combination of values
> ,selected
> from table_1. column_id is the foreign key.
> this is the general idea :
> -----------------------------------------------------------------
> CREATE OR REPLACE TRIGGER tr_Trigger
> AFTER INSERT OR UPDATE OF column_x ON table_1
> DECLARE
> v_Count INTEGER;
> BEGIN
> SELECT COUNT(*) INTO v_Count FROM table_1 WHERE column_id=
> :new.column_id;
> IF v_Count > 0 THEN
> UPDATE table_2 SET column_y = 'KOKO';
> END IF;
> END;
> ------------------------------------------------------------------------
> I was trying to query another table that is audit table of a
 table_1.(mirror
> image)
> I was trying to query a view that consist of the columns of a table_1.
> Every time I do this ORACLE detects a relation to the table_1 ,and I'm
> getting this error.
> I try to create temporary table to store the values, and create multiple
> triggers routine,so
> I could avoid direct querying on the mutating table, but for my needs it
> does not do it,
> because I can only insert one row at the time into a temporary table.(and
 I
> need COUNT(*)),and it still,detects that
> table_1 is mutating......
> There has to be a way to avoid this problem.
> If anyone knows how to do it,
> please let me know !!!!
> Thanks a lot.
> Igor Lyulkin.

>
> Received on Sat Apr 22 2000 - 00:00:00 CDT

Original text of this message

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