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>

相关推荐
想做富婆6 小时前
oracle: 多表查询之联合查询[交集intersect, 并集union,差集minus]
数据库·oracle·联合查询
是小崔啊1 天前
Spring Boot - 数据库集成07 - 数据库连接池
数据库·spring boot·oracle
扎量丙不要犟1 天前
rust如何操作oracle
数据库·oracle·rust
字节全栈_OYI2 天前
在Windows中 基于Oracle GoldenGate (OGG)进行MySQL->MySQL数据库同步配置(超详细)_ogg-15146
数据库·windows·oracle
MXin52 天前
【DB】Oracle存储过程
数据库·oracle
GIS小小研究僧2 天前
PostgreSQL 数据库备份与还原
数据库·postgresql·oracle·postgis
码农幻想梦3 天前
实验十 数据库完整性实验
数据库·sql·oracle
小安同学iter3 天前
MySQL数据库(二)
数据库·sql·mysql·oracle
zZeal3 天前
Django ORM解决Oracle表多主键的问题
后端·python·oracle·django
martian6653 天前
第22篇:Python开发进阶:详解使用SQLAlchemy进行ORM数据库编程技术
数据库·python·oracle