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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Deleting from a related tables.

Re: Deleting from a related tables.

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 10 Jul 2001 10:38:07 -0700
Message-ID: <9ifehv01ekm@drn.newsguy.com>

In article <9ifaci$1lq$1_at_news3.cadvision.com>, "Jeff says...
>
>Hey all,
>
>This is a very simple question I'm sure............. anyway, can anyone tell
>me the best way to delete a record that has data in related tables.
>Basically I need to know if there is a way to cascade a delete when deleting
>from the top table. I am using Oracle 8i as a backend for my online
>application. I need to allow the Admin to delete records.......
>
>Thanks ,
>Jeff
>
>

Use declaritive RI:

create table top ( x int primary key );

create table child ( x references top ON DELETE CASCADE );

That would be the best way.

--
Thomas Kyte (tkyte@us.oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Tue Jul 10 2001 - 12:38:07 CDT

Original text of this message

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