oracle主键必须加分区字段,oracle分区表和主键关系



--全局唯一索引

create table test_par1

(

tdate   varchar2(8) primary key

)

partition by range ( tdate )

(

partition p1 values less than ('20090201'),

partition p2 values less than ('20090301'),

partition pm values less than (MAXVALUE)

) ;

--分区普通索引

create table test_par2

(

tdate   varchar2(8)

)

partition by range ( tdate )

(

partition p1 values less than ('20090201'),

partition p2 values less than ('20090301'),

partition pm values less than (MAXVALUE)

) ;

create index i_tdate2 on test_par2(tdate) local;

alter table test_par2 add constraint pk_tdate2 primary key(tdate);

--分区唯一索引 create table test_par3 (   tdate   varchar2(8),   constraint pk_tdate3 primary key (tdate) using index local ) partition by range ( tdate ) (      partition p1 values less than ('20090201'),      partition p2 values less than ('20090301'),      partition pm values less than (MAXVALUE)  ) ;