Oracle项目实践之---oracle删除被其他表关联的主表(ORA-02449)

1:创建父表

create table db_father

(

id number(11) primary key,

name varchar(25) not null,

location varchar2(50)

 

)

 

 

2:创建子表

 

create table db_child

(

id number(11) primary key,

name varchar(25) not null,

deptID number(11),

salary number(9,2),

---子表的外键deptId关联父表的id字段

constraint fk_1_2 foreign key(deptId) references db_father(id)

)

 

需要移除子表的外键约束

alter table db_child drop constraints fk_1_2;

 

再次查看子表的表结构

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章