ORA-02440: Create as select with referential constraints not allowed ORACLE 报错 故障修复 远程处理

文档解释

ORA-02440: Create as select with referential constraints not allowed

Cause: create table foo (… ref. con. …) as select …;

Action: Create the table as select, then alter the table to add the constraints afterwards.

ORA-02440是Oracle数据库中的一种数据库错误,它表示用户尝试使用CREATE AS SELECT语句来创建一个新的表,并且表中具有引用约束(例如外键),这样的语句显然是无效的,因为引用约束的创建必须先于表的创建。

官方解释

常见案例

正常处理方法及步骤

1、首先,创建外键约束。

2、紧接着,使用CREATE TABLE…AS SELECT语句去创建新表,而不把外键约束包含在定义中。

3、最后,应用外键约束到新创建的表上。


数据运维技术 » ORA-02440: Create as select with referential constraints not allowed ORACLE 报错 故障修复 远程处理