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: Newbie to triggers

Re: Newbie to triggers

From: Lucas <Lucas_44_at_hotmail.com>
Date: Thu, 25 Apr 2002 14:42:32 GMT
Message-ID: <sBUx8.12440$n%4.902110@news2.telusplanet.net>


Thanks, all this works fine now. Don't know what I was doing wrong...

"Ken Denny" <ken_at_kendenny.com> wrote in message news:Xns91FACE2B5320Akendenny_at_65.82.44.7...
> "Lucas" <Lucas_44_at_hotmail.com> wrote in
> news:WDFx8.12147$n%4.807368_at_news2.telusplanet.net:
>
> > Can somebody give me a simple example on how to get a value (ex:
> > foreign key) from a 'new record' on a 'after insert' trigger? I know
> > all about the mutating error, just don't know how to get around it....
>
> To get the value of a column from a record that is being inserted in an
> "after insert" trigger use :new.column_name
>
> The mutating error occurs when you try to read the table you're updating.
> To get around it, use a row-level trigger to save the values you need in
> a memory array, then use a statement-level trigger to do the reading.
>
> > Also, how do you use the :new and :old that I frequently see? When i
> > try it, I get 'bad bind variable'
>
> You should be able to use :new.column_name and :old.column_name without
> getting any error. You must have been trying to use :new and :old without
> the column name. If you're doing an insert then :old.column_name will
> always be null.
>
> --
> Ken Denny
> http://www.kendenny.com/
>
> Always remember you're unique... Just like everyone else.
>
Received on Thu Apr 25 2002 - 09:42:32 CDT

Original text of this message

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