How to Drop Foreign Key in Oracle

To explore about How a foreign key can be added to an already existing table click here. Also, in the previous article, you got to know about adding primary key and Drop primary key to an already existing table.

Moving ahead, let's discuss how to drop a foreign key from an existing table without affecting the values present under that attribute. Follow the syntax below to perform the same task.

Foreign Key Drop Syntax Oracle

Alter table Table_name 
drop Constraint Constraint_name

Drop Foreign Key in Oracle Example

We have table Stu:

Drop Foreign Key in Oracle Example

Also, we have a partner table that has the Roll_no column as a reference key to Roll_no in Stu table.

Follow the partner table as below:

Drop Foreign Key in Oracle Example

To Link these two table through a foreign key, we used the following code:

alter table partner
Add Constraint Partner_fk 
FOREIGN KEY(Roll_No) REFERENCES Stu(Roll_No);

Now to Drop the above make foreign key, the code is as follows: 

Alter table Partner
drop Constraint Partner_fk;

Output

Drop Foreign Key in Oracle Example