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;

 

再次查看子表的表結構

 

 

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