1、首先應該刪除已有的主鍵約束
①若已知道該主鍵命名
alter table 表名 drop constraint 主鍵名;
②若不知道朱建命名
SELECT * from user_cons_columns c where c.table_name = '表名';
找到主鍵欄位column對應的主鍵名,再執行①
2、增加新的主鍵約束
alter table 表名 add constraint 主鍵名 primary key(欄位名);
alter table 表名 add constraint PK名 primary key (列名);
[admin via ] ORACLE 更改主鍵已經有573次圍觀