Oracle建立primary key时会自动创建一个unique index,
删除主键的同时,它会自动删除在该主键上的索引,有的时候删除主键后,索引依然还存在。
下面的操作保证删除索引。
删除主键的同时,它会自动删除在该主键上的索引,有的时候删除主键后,索引依然还存在。
下面的操作保证删除索引。
--删除主键
alter table student drop constraint PK_student cascade drop index;
--添加主键
alter table student
add constraint PK_student primary key (CODE, NUM)
using index
tablespace DATACORE
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 192K
minextents 1
maxextents unlimited
);