Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: deleting child records
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
![]() |
![]() |