歡迎您光臨本站 註冊首頁
小知識  >  Oracle >

ORACLE 更改主鍵

admin @ 2017-12-03 reply:0
←手機掃碼閱讀

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次圍觀

http://coctec.com/room/show-684.html