split partition

wmlm發表於2011-11-08

drop table salestable;
CREATE TABLE salestable
(s_productid NUMBER,
s_saledate DATE,
s_custid NUMBER,
s_totalprice NUMBER)
PARTITION BY RANGE(s_saledate)
(PARTITION sal99q1 VALUES LESS THAN (TO_DATE('01-APR-1999', 'DD-MON-YYYY')),
PARTITION sal99q2 VALUES LESS THAN (TO_DATE('01-JUL-1999', 'DD-MON-YYYY')),
PARTITION sal99q3 VALUES LESS THAN (TO_DATE('01-OCT-1999', 'DD-MON-YYYY')),
PARTITION sal99q4 VALUES LESS THAN (TO_DATE('01-JAN-2000', 'DD-MON-YYYY')),
PARTITION sal00q1 VALUES LESS THAN (TO_DATE('01-APR-2000', 'DD-MON-YYYY')),
PARTITION sal00q2 VALUES LESS THAN (TO_DATE('01-JUL-2000', 'DD-MON-YYYY')),
PARTITION sal00q3 VALUES LESS THAN (TO_DATE('01-OCT-2000', 'DD-MON-YYYY')),
PARTITION sal00q4 VALUES LESS THAN (TO_DATE('01-JAN-2001', 'DD-MON-YYYY')),
PARTITION sql_max VALUES LESS THAN (maxvalue)
);

ALTER TABLE salestable SPLIT PARTITION sql_max
AT (TO_DATE('01-APR-2001','DD-MON-YYYY'))
INTO (PARTITION sal01q1, PARTITION sql_max);

ALTER TABLE salestable SPLIT PARTITION sql_max
AT (TO_DATE('01-JUL-2001','DD-MON-YYYY'))
INTO (PARTITION sal01q2, PARTITION sql_max);

[@more@]

END.

大肚能容,容世間難容之事;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/271063/viewspace-1056212/,如需轉載,請註明出處,否則將追究法律責任。