-- Create sequence
create sequence SQ1
minvalue 1
maxvalue 999999999999999999999999999
start with 2001
increment by 1
cache 20;
序列的建立
create table testpatition
(
Gid number(10,3) primary key,
GName varchar2(36),
GDate date
)
partition by range(Gid) 選擇要分區(qū)的字段
(
partition p1 values less than(10), 確定分區(qū)的范圍
partition p2 values less than(20),
partition p3 values less than(30),
partition p4 values less than(300),
partition p5 values less than(600),
partition p6 values less than (maxvalue)最大分區(qū)的數(shù)據(jù)
);
表分區(qū)的建立
declare
n number:=1;
begin
while n<2000 loop
insert into testpatition(gid,GName,Gdate) values(sq1.nextval,n,sysdate);
n:=n+1;
end loop;
end;
測試數(shù)據(jù)的添加
select * from testpatition partition (p4)
查詢分區(qū)的數(shù)據(jù)的例子
select * from testpatition
查詢所有的數(shù)據(jù)
posted on 2009-12-02 11:10
sanmao 閱讀(133)
評論(0) 編輯 收藏