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>

相关推荐
christine-rr10 小时前
数据库基础概念体系梳理
数据库·oracle
Web3&Basketball20 小时前
达梦数据库性能调优总结
数据库·oracle
Brianna Home21 小时前
博客安全攻防演练:从攻击者视角构筑铜墙铁壁
网络·数据库·安全·oracle
-雷阵雨-1 天前
MySQL——桥梁JDBC
数据库·mysql·oracle
亿坊电商1 天前
在PHP框架里如何进行数据库连接?
数据库·oracle·php
曹牧1 天前
oracle:NOT IN
数据库·oracle
木易2.02 天前
从零构建RAG知识库管理系统(二)
数据库·oracle
表示这么伤脑筋的题我不会2 天前
Oracle 21C 部署ogg踩过的坑
数据库·oracle
fredinators2 天前
数据库flask访问
数据库·oracle·flask
ytttr8732 天前
C# 仿QQ聊天功能实现 (SQL Server数据库)
数据库·oracle·c#