Foreign key创建前提 Primay key 可以disable,但必须要有

SQL>

SQL> alter table A

2 drop constraint ABCD primary key (A)

3 disable

4 novalidate;

alter table A

drop constraint ABCD primary key (A)

disable

novalidate

ORA-01735: invalid ALTER TABLE option

SQL>

SQL> alter table A

2 drop constraint ABCD primary key (A)

3 disable

4 novalidate;

alter table A

drop constraint ABCD primary key (A)

disable

novalidate

ORA-01735: invalid ALTER TABLE option

SQL>

SQL> alter table A

2 drop constraint ABCD

3 ;

alter table A

drop constraint ABCD

ORA-02273: this unique/primary key is referenced by some foreign keys

SQL>

SQL> alter table B

2 drop constraint abc

3 ;

alter table B

add constraint abc

ORA-00931: missing identifier

SQL> alter table B drop constraint abc;

Table altered

SQL>

SQL> alter table B

2 add constraint abc foreign key (A)

3 references a (A)

4 disable

5 novalidate;

Table altered

SQL> alter table B drop constraint abc;

Table altered

SQL> alter table A drop constraint ABCD;

Table altered

SQL> alter table B add constraint abc foreign key (A) references a (A) disable novalidate;

alter table B add constraint abc foreign key (A) references a (A) disable novalidate

ORA-02270: no matching unique or primary key for this column-list

SQL>

SQL> alter table A

2 add constraint ABCD primary key (A)

3 disable

4 novalidate;

Table altered

SQL> alter table B add constraint abc foreign key (A) references a (A) disable novalidate;

Table altered

SQL>

相关推荐
betazhou3 小时前
SQL server之版本的初认知
数据库·oracle·goldengate·sql server·ogg·gdr
lagrahhn9 小时前
pgsql模板是什么?
数据库·oracle
醇醛酸醚酮酯10 小时前
MySQL 的语言体系
数据库·mysql·oracle
学不会就看20 小时前
Django--02模型和管理站点
数据库·oracle·django
白仑色1 天前
Oracle 数据库管理与维护实战指南(用户权限、备份恢复、性能调优)
数据库·oracle·数据库管理·性能调优·备份恢复
wx_ywyy67981 天前
分布式推客系统全栈开发指南:SpringCloud+Neo4j+Redis实战解析
数据库·oracle·推客系统·推客小程序·推客系统开发·推客小程序开发·推客分销系统
HardCodeV1 天前
NestJS
数据库·oracle
叫我菜菜就好1 天前
【node后端】搭建项目(Express+Ts+Typeorm+Mysql一步到位)
mysql·oracle·express
小小不董2 天前
深入理解oracle ADG和RAC
linux·服务器·数据库·oracle·dba
IvanCodes2 天前
Oracle 视图
大数据·数据库·sql·oracle