Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: trigger cause "mutating" error
i think this happens because you're trying to cascade deletion by both
referential integrity and triggers.
I think you're already using a foreign key with 'on delete cascade' so that's
why the trigger fails. Either drop the cascade delete constraint or the
trigger.
junfan wrote:
> Hi,
>
> I created 2 tables as follows:
>
> create table station(
> station_id char(6) primary key,
> name char(20),
> phone char(20)
> );
>
> create table cover_area(
> station_id char(6) primary key,
> area_code char(4)
> );
>
> create or replace trigger del_station
> after delete on station
> for each row
> begin
> delete from cover_area where station_id = :old.station_id;
> end;
>
> I then encountered error when I tried to delete rows from "station":
>
> > delete from station;
> ERROR at line 1:
> ORA-04091: table CCC.COVER_AREA is mutating, trigger/function may not see
> it
> ORA-06512: at "CCC.DEL_STATION", line 2
> ORA-04088: error during execution of trigger 'CCC.DROP_COVER_AREA'
>
> I was told the problem is due to "cover_area" is locked. but how can i
> overcome the error?
>
> Regards
Received on Tue Jul 04 2000 - 00:00:00 CDT
![]() |
![]() |