--主键是非分区索引,也可以看作是全局
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)
) tablespace test;
--主键是分区索引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)
) tablespace test;
create index i_tdate2 on test_par2(tdate)
local;
alter table test_par2
add constraint pk_tdate2
primary key(tdate);
--查看test_par2的DDL
select dbms_metadata.get_ddl( 'TABLE', 'TEST_PAR2' ) from dual;
--整理如下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)
) tablespace test;
这个案例也告诉我们,在做DDL时,尽量还是显示的写出属性,一些简易语法会引起不可知的定义。最后都用 get_ddl 再查一下,这才是Oracle真正执行的DDL。
posted on 2010-09-15 15:26
Jcat 阅读(1273)
评论(0) 编辑 收藏 所属分类:
Database