Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: trigger cause "mutating" error
"Walter T Rejuney" <BlueSax_at_Unforgetable.com> wrote in message
news:39638949.9086606A_at_Unforgetable.com...
> budanoff_at_my-deja.com wrote:
> >
> > In article <01bfe599$52224d80$a0364f0f_at_bj210276>,
> > If you want to enable referential integrity, then you'd better use
> > foreign keys.
> > create table station(
> > station_id char(6) primary key,
> > name char(20),
> > phone char(20)
> > );
> >
> > create table cover_area(
> > station_id char(6),
> > area_code char(4)
> > constraint fk_cover_area_station_id foreign key(station_id) references
> > station(station_id) on delete cascade
> > );
> >
> > After
> > >delete from station;
> > all records from cover_area will be deleted too.
>
> When rows are deleted this way, how are the foreign key rows identified?
> The reason I'm asking this is because I wonder if I need to have an
> index on the foreign key column.
You do *always!*. Otherwise Oracle will place an exclusive lock on the table in constraint checking.
Regards,
Sybrand Bakker, Oracle DBA Received on Wed Jul 05 2000 - 00:00:00 CDT