Preamble
After creating a foreign key, you may need to drop the foreign key from the table. You can do this with the ALTER TABLE operator in Oracle/PLSQL.
Syntax to drop a foreign key in Oracle / PLSQL
ALTER TABLE table_name
DROP CONSTRAINT constraint_name;
Example
If you created a foreign key like this:
CREATE TABLE supplier
( supplier_id numeric(10) not null,
supplier_name varchar2(50) not null,
contact_name varchar2(50),
CONSTRAINT supplier_pk PRIMARY KEY (supplier_id)
);
CREATE TABLE products
( product_id numeric(10) not null,
supplier_id numeric(10) not null,
CONSTRAINT fk_supplier
FOREIGN KEY (supplier_id)
REFERENCES supplier(supplier_id)
);
In this example we created the primary key table of the supplier called supplier_pk.
It consists of only one supplier_id field. Then we created a foreign key named fk_supplier in the products table that refers to the supplier table based on the supplier_id field.
If we need to drop the foreign key named fk_supplier, we need to execute the following command:
ALTER TABLE products
DROP CONSTRAINT fk_supplier;
SQL tutorials: SQL Foreign Key Constraint
About Enteros
Enteros offers a patented database performance management SaaS platform. It proactively identifies root causes of complex business-impacting database scalability and performance issues across a growing number of clouds, RDBMS, NoSQL, and machine learning database platforms.
The views expressed on this blog are those of the author and do not necessarily reflect the opinions of Enteros Inc. This blog may contain links to the content of third-party sites. By providing such links, Enteros Inc. does not adopt, guarantee, approve, or endorse the information, views, or products available on such sites.
Are you interested in writing for Enteros’ Blog? Please send us a pitch!
RELATED POSTS
How Enteros Improves Database Performance in the Healthcare Sector: Leveraging AIOps Platforms for RevOps Efficiency
- 17 August 2025
- Database Performance Management
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…
How Enteros Enhances Database Performance and Cost Estimation for SaaS E-Commerce Platforms
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…
How Enteros Transforms Database Performance Management for the AI Sector: Optimizing Generative AI Workloads with an AIOps Platform
- 15 August 2025
- Database Performance Management
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…
How Enteros Transforms Database Performance Management and Cost Estimation in the Healthcare Sector
- 13 August 2025
- Database Performance Management
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…