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: Mutation on an after update row trigger :? - a work around would be helpful :

Re: Mutation on an after update row trigger :? - a work around would be helpful :

From: Luis Morales Boisset <lboisset_at_infonis.es>
Date: Fri, 3 Aug 2001 08:09:50 +0200
Message-ID: <9kdek3$qu8$1@talia.mad.ttd.net>

Hello,

You give too few information about your trigger but in general you got problems with mutating when you do selects on tables in "for each row" triggers. Let me explain. there are to different levels of triggers: at row level and at table level. At row level triggers gives you access to the value of the columns (of that specific row change) but you can't do selects over a changed table (specially the triggered one). At table level in the other hand gives you access to the table but not to the field values.

The order if i'm not wrong is Before Trigger Table Level, then before for each row, then after for each row and then after at table level.

The common workarraound to this is in the documentation (I think it's in the PL/SQL section, in triggers chapter) is based on passing the meanningful values from the row level trigger to the table level one so the table level one could do the proper select and then se proper update (be carfully selecting the fields that raise the trigger because this last trigger could raise them again ending in a infinite loop). To past this values between triggers normally you use a package definition an PL/SQL table types and a counter but it's better to take a look at the documentation (where I said previously) it's better than any explanation I could give.

Regards

    Luis.

--
---------------------------------------
Luis Morales Boisset
email: lboisset at arrakis.es
http://www.arrakis.es/~lboisset

"CME" <support_at_cmesys.demon.co.uk> escribió en el mensaje
news:996770948.8474.0.nnrp-01.c2de4217_at_news.demon.co.uk...

> Dear all,
>
>
> I have a trigger that basically updates one field within the record with
the
> current date, so we are able to see when the row was last updated. This
code
> has worked fine in VB against a Sybase database.
>
>
> Now however I am getting a mutation. I have read around the subject and it
> states that I am trying to do two updates on the row :)...which is
correct.
>
>
>
> Bascially I want the LastUpdated field to be updated whenever that row is
> updated.
>
>
> Any help would be gratefully received.
>
>
> Thanks
>
>
> Matt.
>
>
Received on Fri Aug 03 2001 - 01:09:50 CDT

Original text of this message

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