且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

删除外键约束

更新时间:2023-02-02 22:58:49

由于您没有指定约束名称,Oracle会为您生成一个c $ c> SYS_034849548 )。

As you did not specify a constraint name, Oracle generated one for you (something like SYS_034849548).

您需要找到约束名称才能删除它:

You need to find the constraint name in order to be able to drop it:

select constraint_name
from user_constraints
where table_name = 'ABC'
  and constraint_type = 'R'

将显示约束名称。然后你可以使用下面的方法删除约束:

will display the constraint name. Then you can drop the constraint using:

alter table abc drop constraint <constraint_name>;

(替换< constraint_name>

请注意语法是 alter table ... drop constraint 。没有 drop foreign key

Note that the syntax is alter table ... drop constraint. There is no drop foreign key.