Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: a simple Trigger question
Your trigger should be:
create or replace trigger firea
before insert on temp
for each row
begin
:new.col2 := :new.col1 + 1000;
end firea;
--
Have a nice day
Michel
Joseph Chang <chinastorm_at_bigfoot.com> a écrit dans le message :
8107nr$1sa1$1_at_news.cz.js.cn...
> Hi everybody!
> i am a pl/sql beginner. i have a prblem about trigger.
> the temp table looks like that
> col1(number) col2 (number)
> when i insert a new record to this table, the col2 should be col1+1000 .
> i try the trigger like that:
>
> create or replace trigger firea
> after insert on temp
> for each row
> declare
> temp_col1 temp._col1%type;
> begin
> update temp set col2=:new.col1+1000 where col1= :new.col1;
> end firea;
>
> it compile ok, but when i insert a record to temp , the oracle said
> ORA-04091: table SM.TEMP is mutating, trigger/function may not see it
> ORA-06512: at "SM.FIREA", line 4
> ORA-04088: error during execution of trigger 'SM.FIREA'
>
> any tip for solve the problem by change this trigger?
>
>
>
>
Received on Thu Nov 18 1999 - 06:52:42 CST