Method: 1. Use the "ALTER TABLE table name DROP CONSTRAINT constraint name;" statement to delete the primary key constraint; 2. Use the "Alter Table table Modify column type Null;" statement to delete the non-null constraint.
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
1. Delete primary key constraints:
Alter table 表名 drop 约束名
With named primary key:
Alter table one drop constraint pk_one;
No named primary key: Available Select * from user_constraints search The primary key name constraint_name in the table, and then use the found primary key name. For example: alter table student drop constraint SYS_C002715;
(When deleting component constraints, you must also delete the foreign key constraints that reference the primary key). For example:
alter table two drop constraint two_pk_id;
2. Delete non-empty constraints:
Syntax:
Alter Table 表 Modify 列 类型 Null;
For example:
Alter table one Modify name null;
Recommended tutorial: "Oracle Video Tutorial"
The above is the detailed content of How to delete oracle constraints. For more information, please follow other related articles on the PHP Chinese website!