Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Cascade Deletes
I guess it all depends on the application. I believe that cascade deletes are
very useful in particular situations because it is a sure fire way of getting
rid of all related records. There is one problem that I can see though. If
you had a table, lets just say and employee table for and example. This
employee table has SSN numbers as a primary key. Also in this table you have
the SSN number of that employees supervisor. The supervisor is a foreign key
to the primary key (employee SSN). Now, if you had a cascade delete on the
foreign key, and lets say you wanted to delete an SSN from the table, you
would wipe out records that had that SSN for the supervisor. In this case you
would not want to use a CASCADE, instead you might use a SET NULL ON DELETE,
so that the supervisor field gets set to null instead of deleting the
employee. It is all kind of hard to explain in words, but I could maybe see
why they don't want to use it. Depending on the complexity, you could
inadversly reek havoc on your database because these deletes are behind the
scene.
good luck
kevin
Manoj Goel wrote:
> hi Guys,
>
> I have been asked to not to use cascade deletes in our app which is
> running on
> oracle 7.3 . But I thought that if it is an option provided by the RDBMS
> then why
> not use it ?
>
> What could be disadvantages??
>
> Please help me understand it.
>
> Thanks
>
> Manoj
--
The opinions expressed in this message are purely my own and NOT those of my company.