Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Trigger problem
Hi,
I have very simple table "t1" in Oracle 8.1.7 database, I wrote a trigger on "t1" and got an error when I update "t1".
ORA-04091: table T1 is mutating, trigger/function may not see it ORA-06512: at "AU_T1", line 4 ORA-04088: error during execution of trigger AU_T1'
But the same trigger works fine in Sybase.
How can I write this trigger so I can "select" or "update" other rows in the same table in my trigger?
Thanks in advance.
-Michael
====Table====
create table t1 (
tid number(10) primary key,
name varchar2(40)
);
====Trigger====
create or replace trigger au_t1
before insert or update
on t1
referencing old as old new as new
for each row
declare
cc number(10);
begin
select count(tid) into cc from t1;
end;
/
====Update====
update t1 set tid=2 where tid=1;
Received on Mon Mar 11 2002 - 14:30:16 CST
![]() |
![]() |