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

Home -> Community -> Usenet -> c.d.o.server -> Re: deleting child records

Re: deleting child records

From: tmgn <tmgn_at_excite.com>
Date: Mon, 02 Aug 1999 15:25:18 -0400
Message-ID: <37A5F09E.A52EAFD5@excite.com>


Add a 'DELETE CASCADE' condition to the Foreign Key Constraint .That would solve the problem..

>alter table <child_Table> drop constraint <Constraint_name>;
>alter table <child_table> add(constraint <constraint_name> Foreign Key(id)
references program(id) on delete cascade);

Hope this helps..

-Thiru

Finnegan Calabro wrote:

> how do you modify the delete command to automatically delete all child
> records linked to a record you're trying to delete? i tried just a regular
> delete and i got an error (id is the primary key in the table program and
> the foreign key in another table). thanks!
>
> SQL> delete from program where id='abcdef';
> delete from program where id='abcdef'
> *
> ERROR at line 1:
> ORA-02292: integrity constraint (METRICS.SYS_C001436) violated - child
> record found
Received on Mon Aug 02 1999 - 14:25:18 CDT

Original text of this message

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