-- Create Sequence
Create sequence Sq1
Minvalue 1
Max value 999999999999999999999999999
Start with 2001
Increment by 1
Cache 20;
Sequence Creation
Create Table testpatition
(
GID number (10, 3) primary key,
Gname varchar2 (36 ),
Gdate date
)
Partition by range (GID) Select the field to be partitioned
(
Partition P1 values less than (10), determine the partition range
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) Maximum partition data
);
Create Table partitions
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;
Add Test Data
Select * From testpatition partition (P4)
Example of querying partition data
Select * From testpatition
Query all data