Range partitioning


Partition on a numeric value range:
CREATE TABLE anar (
 anarno NUMBER(4), 
 ename VARCHAR2(30), 
 sal NUMBER
) 
PARTITION BY RANGE(anarno) (
 partition e1 values less than (1000) tablespace tablespace_anar1, 
 partition e2 values less than (2000) tablespace tablespace_anar2, 
 partition e3 values less than (MAXVALUE) tablespace tablespace_anar3
);
Partition on a VARCHAR2 string:
CREATE TABLE anar
( id NUMBER(5) PRIMARY KEY,
 name VARCHAR2(50) NOT NULL,
 phone VARCHAR2(15),
 email VARCHAR2(100) )
PARTITION BY RANGE ( name )
 ( PARTITION p1 VALUES LESS THAN ('L') TABLESPACE tablespace_anar1,
 PARTITION p2 VALUES LESS THAN (MAXVALUE) TABLESPACE tablespace_anar2 )
Time based range partitioning:
CREATE TABLE t1 (id NUMBER, c1 DATE)
PARTITION BY RANGE (c1)
 (PARTITION t1p1 VALUES LESS THAN (TO_DATE('2007-11-01', 'YYYY-MM-DD')),
 PARTITION t1p2 VALUES LESS THAN (TO_DATE('2007-12-01', 'YYYY-MM-DD')),
 PARTITION t1p3 VALUES LESS THAN (TO_DATE('2008-01-01', 'YYYY-MM-DD')),
 PARTITION t1p4 VALUES LESS THAN (MAXVALUE)
 );
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: