king

怎样删除oracle约束

king Oracle 2022-06-29 940浏览 0

怎样删除oracle约束

1、删除主键约束:

Alter table 表名 drop 约束名

有命名主键:

Alter table one drop constraint pk_one;

无命名主键:可用Select * from user_constraints 查找表中的主键名称constraint_name,再使用查到的主键名称 例如:alter table student drop constraint SYS_C002715;

(删除组件约束时也要删除引用该主键的外键约束)例如:

alter table two drop constraint two_pk_id;

2、删除非空约束:

语法:

Alter Table 表 Modify 列 类型 Null;

例如:

Alter table one Modify name  null;


继续浏览有关 oracle 的文章
发表评论