怎樣刪除oracle約束

方法:1、利用“ALTER table 表名 DROP CONSTRAINT 約束名;”語句刪除主鍵約束;2、利用“Alter Table 表 Modify 列 類型 NULL;”語句刪除非空約束。

怎樣刪除oracle約束

本教程操作環境:Windows10系統、oracle 11g版、Dell G3電腦。

怎樣刪除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視頻教程

以上就是怎樣刪除

? 版權聲明
THE END
喜歡就支持一下吧
點贊7 分享