Test example of Oracle table range partitioning

Source: Internet
Author: User

-- 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

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.