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: Trigger help.

Re: Trigger help.

From: Patrick Flahan <flahan_at_southeast.net>
Date: 1998/02/06
Message-ID: <6bgopt$1u2@news.southeast.net>#1/1

A mutating error occurs when you try to modify the same table as the one that the trigger belongs to. This type of action could lead to severe problems. Let's say you insert one group of rows, and then the trigger is performed. You then have an insert in the trigger which is performed which then calls the same trigger which tries to insert, and so on.

I would say the best way to implement this type of action would be with a stored procedure/function. You could have the function perform the inserts and the running totals(?) and then insert the final line.

Hope this helps.
Patrick Flahan
flahan_at_leading.net



Thomas J Madigan wrote in message ...
>
>Hello,
>
> I am having difficulties setting up a simple trigger. What i want
>to do is this: after a insert on a table, select 2 different attributes,
>add them together and insert the result into a third addribute. I dont
>want to do a row level trigger because it doesnt make sense to have to
>operate on all the rows, just the most recent. The basic problem i
>encountered was how to select the proper row. I tried to impliment a
>statement level, after insert trigger and recieved this error:
>
> ROR at line 1:
> ORA-04082: NEW or OLD references not allowed in table level triggers
>
>i have never heard of a "table level trigger" and cant find reference to
>it anywhere. (pretty much typical for my oracle experiences).
>In another attempt, i get this error:
>
> insert into test(test_first, test_second) values(4, 3)
> *
> ERROR at line 1:
> ORA-04091: table MADIGAN.TEST is mutating, trigger/function may not see it
> ORA-06512: at "MADIGAN.PLEASE_WORK", line 7
> ORA-04088: error during execution of trigger 'MADIGAN.PLEASE_WORK'
>
>This time i have no idea what 'mutating' means. (i suspect it means
>that the table is threatening to turn into the incredible hulk.)
>
>Any help would be appreciated... (please respond by e-mail as well)
>Thanks.
>
>
>--
>tj madigan
>e-mail: madigan_at_mscs.mu.edu
>http://studsys.mscs.mu.edu/~madigan
>
>
>
>
Received on Fri Feb 06 1998 - 00:00:00 CST

Original text of this message

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