Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to Remove Foreign Key Constraint

619418Jan 24 2008 — edited Jun 6 2008
Hello Freinds,

I have created two sample tables ...

----------------------------------------------------------------
create table primaryTable(id int primary key,value int);
OK; 1 row affected

create table childTable(id1 int primary key,id int references primaryTable(id),value int);
OK; 1 row affected

ants_dsn_3.4> select * from childTable;
---------------------------------------
| ID1 | ID | VALUE |
---------------------------------------
| 1 | 1 | 1 |
| 2 | 2 | 1 |
| 3 | 3 | 1 |
---------------------------------------
OK; Returned 3 rows from 3 fields

ants_dsn_3.4> select * from primaryTable;
--------------------------+
| ID | VALUE |
--------------------------+
| 1 | 1 |
| 2 | 1 |
| 3 | 1 |
--------------------------+

I want to drop the Foreign key in the Child Table.
And when i do that i get the Following error.

ants_dsn_3.4> alter table childTable drop ID;
[ANTs Software][ANTs DATABASE ODBC driver][ants_dsn_3.4] Server returned error : ERROR (70007): Cannot drop the column 'ID' that has a constraint on it

----------------------------------------------------------------
Freinds Can you help to solve this problem as iam new to data base side.

Thanks in advance,
Faizan.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2008
Added on Jan 24 2008
7 comments
65,031 views