--按范围建分区表
create table testpar
(
id number not null,
name varchar2(100),
title number
)
partition by range(title)
(
partition title1000 values less than (1000),
partition title2000 values less than (2000),
partition title3000 values less than (3000)
)
--插入数据
declare
begin
for n in 1..4000 loop
insert into testpar(id,name,title)
values(n,'name'||n,n);
end loop;
commit;
end;
--这时会报错,因为分区表只能插入<3000的记录,所以需要修改分区
alter table testpar add partition titlemax values less than(maxvalue);
其中maxvalue是不定值,但总大于数据库的最大值。
--删除分区中的数据
alter table testpar truncate partition title1000;
--删除分区
alter table testpar drop partition title1000;