What is the use of CASCADE CONSTRAINTS?

When this clause is used with the DROP command, a parent table can be dropped even when a child table exists.

Showing Answers 1 - 7 of 7 Answers

Anuradha

  • Oct 13th, 2005
 

Ans:

       The CASCADE CONSTRAINTS clause drops all referencial integrity constraints that refer to the primary and unique keys defined on the dropped columns.

Thanagdurai

  • Jul 25th, 2007
 

Hi,

Deletes all Foreign keys that reference the table to be dropped, then drops the table.


Reds
Tahngam.

  Was this answer useful?  Yes

jpundalik

  • Dec 30th, 2009
 

This is used enforce the constraints to delete the chaild records when corresponding parent records are deleted.

This can be explained with below example

- Parent table has department details
create table dpt (dno number constraint mypk1 primary key,
dname varchar2(60))

- Child table that contains employee information corrponding to department
create table em (eno number constraints mypk2 primary key,
ename varchar2(100),
job varchar2(30),
dno number,
constraints pmfk1 foreign key(dno) references dpt(dno) on delete cascade)

Cascade constaints is enforced. Now when you delete any records from dpt table correponding (with reference to dno) records in the em also will get deleted.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions