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>

相关推荐
jnrjian5 天前
ORA-01017 查找机器名 用户名 以及library cache lock 参数含义
数据库·oracle
TTc_5 天前
oracle中的union和union all有什么区别?
数据库·oracle
山峰哥5 天前
吃透 SQL 优化:告别慢查询,解锁数据库高性能
服务器·数据库·sql·oracle·性能优化·编辑器
南 阳5 天前
Python从入门到精通day37
数据库·python·oracle
轩情吖5 天前
MySQL库的操作
android·数据库·mysql·oracle·字符集·数据库操作·编码集
脱发的老袁5 天前
【数据库】Oracle手动清理归档日志
数据库·oracle
jnrjian5 天前
Oracle 共享池 库缓存下的 Library Cache Lock
数据库·缓存·oracle
新缸中之脑6 天前
在Reddit上探索未满足的需求
数据库·oracle
light blue bird6 天前
产线多并发客户端指令操作场景组件
jvm·oracle·.net·winform
坐吃山猪6 天前
Neo4j04_数据库事务
数据库·oracle·neo4j