I have a big table with partitions.
ex:
CREATE TABLE cust_order (
cust_id NUMBER(10),
start_date VARCHAR2(25),
amount_sold NUMBER(10,2))
PARTITION BY RANGE (START_DATE)
(
PARTITION MAY VALUES LESS THAN ('20120601'),
PARTITION DEF VALUES LESS THAN(MAXVALUE));
I want to alter the table so that the MAY partition contains values less than ‘20120501’ and that the data from ‘20120501’ to ‘20120601’ are stored in the DEF partition.
First, you should always store dates in
DATEcolumns. Storing dates in aVARCHAR2(25)column is a recipe for problems down the line– someone will inevitably insert a string that has an unexpected format.Second, assuming that there are no partitions between the
MAYandDEFpartitions, you could split theMAYpartitionand then merge the
JUNE_TEMPandDEFpartitionsI’m not sure that I see the wisdom, however, in doing this… A default partition should not generally store any data– it’s generally only there so that inserts don’t error out if they have an unexpectedly large partition key. So taking the data that is already in one partition and moving it into a default partition seems rather odd. If you’re just going to create a
JUNEpartition in the future, I’m not sure why you wouldn’t just split the partitions into aMAYandJUNEpartition.