Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Mutating
This is a multi-part message in MIME format.
------=_NextPart_000_01BC79C5.23562E60
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Hello,
You can't read values out of a table where the trigger is on. Try using a column-constraint. That should do it...
Good luck,
Willem Gestel
Deventer
The Netherlands
Business Information Services <email_at_bisinfo.com.au> wrote in article
<MPG.e07759eaa6e0a29989696_at_nsw-newshost.tpgi.com.au>...
> Greeting all!
>
> We have a before insert and update trigger set up on a table called
> "FILLER_RUN" with the following code.
>
> DECLARE
> MAX_DATE date;
> BEGIN
>
> SELECT MAX(EFFECTIVE_FROM)
> INTO MAX_DATE
> FROM FILLER_RUN
> WHERE RUN_FK = :NEW.RUN_FK;
>
> ... if .. then etc.
> END;
>
> A "run" can have many "effective from" dates. The purpose of this query
> is to find the current maximum effective date for a run which we then
> compare with the date the user is trying to enter. If it is less than or
> equal to the max date for that run then we raise an exception.
>
> We are getting a mutating table error but we thought that this only
> occured when you tried to change something in the trigger. All we are
> doing is reading from the database.
>
> Can anyone help out?
>
> Regards,
> Peter.
> --
> Business Information Services
> (For more information call Brad Deveson)
>
> Tel: (02) 9387-2509 (Australia)
> Fax: (02) 9369-3840 (Australia)
> mailto:email_at_bisinfo.com.au
> http://www.bisinfo.com.au
>
------=_NextPart_000_01BC79C5.23562E60
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<html><head></head><BODY bgcolor=3D"#FFFFFF"><p><font size=3D2 = color=3D"#000000" face=3D"Arial">Hello,<br><br>You can't read values out = of a table where the trigger is on. Try using a column-constraint. That = should do it...<br><br>Good luck,<br><br>Willem = Gestel<br>Deventer<br>The Netherlands<br><br><br><br>Business = Information Services <<font =
color=3D"#0000FF"><u>email_at_bisinfo.com.au</u><font = color=3D"#000000">> wrote in article <<font = color=3D"#0000FF"><u>MPG.e07759eaa6e0a29989696_at_nsw-newshost.tpgi.com.au</=u><font color=3D"#000000">>...<br>> Greeting all!<br>> <br>> = We have a before insert and update trigger set up on a table called = <br>> "FILLER_RUN" with the following code.<br>> = <br>> DECLARE<br>> MAX_DATE = date;<br>> BEGIN<br>> = <br>> SELECT MAX(EFFECTIVE_FROM)<br>> =
INTO MAX_DATE<br>> = FROM FILLER_RUN<br>> = WHERE RUN_FK =3D :NEW.RUN_FK;<br>> <br>> = ... if .. then etc.<br>> END;<br>> =<br>> A "run" can have many "effective from" = dates. The purpose of this query <br>> is to find the current maximum = effective date for a run which we then <br>> compare with the date = the user is trying to enter. If it is less than or <br>> equal to the = max date for that run then we raise an exception.<br>> <br>> We = are getting a mutating table error but we thought that this only = <br>> occured when you tried to change something in the trigger. All = we are <br>> doing is reading from the database.<br>> <br>> Can = anyone help out?<br>> <br>> Regards,<br>> Peter.<br>> -- = <br>> Business Information Services<br>> (For more information = call Brad Deveson)<br>> <br>> Tel: (02) 9387-2509 = (Australia)<br>> Fax: (02) 9369-3840 (Australia)<br>> <font =
color=3D"#0000FF"><u>mailto:email_at_bisinfo.com.au</u><font = color=3D"#000000"><br>> <font = color=3D"#0000FF"><u>http://www.bisinfo.com.au</u><font = color=3D"#000000"><br>> </p>
![]() |
![]() |