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>

相关推荐
多多*12 小时前
算法竞赛相关 Java 二分模版
java·开发语言·数据结构·数据库·sql·算法·oracle
神仙别闹14 小时前
基于C#+SQL Server开发(WinForm)租房管理系统
数据库·oracle·c#
cooldream200920 小时前
深入理解主从数据库架构与主从复制
数据库·oracle·数据库架构·系统架构师
alpha xu2 天前
Qwen智能体qwen_agent与Assistant功能初探
数据库·人工智能·python·oracle·智能体·千问agent
文牧之2 天前
Oracle 通过 ROWID 批量更新表
运维·数据库·oracle
Bing@DBA2 天前
Oracle 19c 静默安装
数据库·oracle
听雪楼主.2 天前
Oracle adg环境下调整redo日志组以及standby日志组大小
oracle·adg
消失在人海中2 天前
oracle 会话管理
数据库·oracle
小Tomkk3 天前
2025年5月15日前 免费考试了! Oracle AI 矢量搜索专业认证
数据库·人工智能·oracle
菲兹园长3 天前
MySql(基础)
数据库·mysql·oracle