Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Kindly Help

Re: Kindly Help

From: Matthias Gresz <GreMa_at_t-online.de>
Date: Tue, 15 Dec 1998 08:15:34 +0100
Message-ID: <36760C96.78E166AD@Privat.Post.DE>


Steven schrieb:
>
> hi,
>
> l have two exiting Parent and Child tables.
>
> May l know what's the actual command for me to use at SQL
> worksheet,
> in order to make them "on cascade delete" ?
>
> Purpose: when l deleted the parent table's record, the child
> table's record
> will be deleted as well.
>

You've got to setup a foreign key constraint with the cascade option and oracle will make all the work for you:

ALTER TABLE emp

   ADD CONSTRAINT fk_deptno

       REFERENCES dept(deptno) 
       ON DELETE CASCADE 

;
HTH
Matthias
--
Matthias.Gresz_at_Privat.Post.DE

Always log on the bright side of life.
http://www.stone-dead.asn.au/movies/life-of-brian/brian-31.htm Received on Tue Dec 15 1998 - 01:15:34 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US