MySQL Forums
Forum List  »  Partitioning

Reorganize Partition Syntax error
Posted by: IGG t
Date: September 16, 2013 03:13AM

Hopefully quite simple, and probably obvious, but what is wrong with my syntax. I've been wrestling with this all morning.

I created a set of partitions thus:

ALTER TABLE `schemaName`.`tableName`
PARTITION BY RANGE (TO_DAYS(`Created`)) (
PARTITION `early` VALUES LESS THAN (TO_DAYS('2013-01-01 00:00:00')),
PARTITION `201301` VALUES LESS THAN (TO_DAYS('2013-02-01 00:00:00')),
PARTITION `201302` VALUES LESS THAN (TO_DAYS('2013-03-01 00:00:00')),
PARTITION `201303` VALUES LESS THAN (TO_DAYS('2013-04-01 00:00:00')),
PARTITION `201304` VALUES LESS THAN MAXVALUE
);

So far so good, the last partition now holds data for anything after 1st April (e.g. April and May).

Now I want to reorganize that partition (201304) so that it holds data for just April, and the data for May is moved into a new 'last' partition. My syntax is:

ALTER TABLE `schemaName`.`tableName` REORGANIZE PARTITION `201304` INTO
(
`201304` VALUES LESS THAN (TO_DAYS('2013-05-01 00:00:00')),
`201305` VALUES LESS THAN MAXVALUE
);

But I get an error which suggests the issue is at the first definition ( 201304` VALUES LESS . . . )

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`201304` VALUES LESS THAN (TO_DAYS('2013-05-01 00:00:00')),
#-->ALL DATA BEFORE ' at line 3

If anyone can spot the error I would be very grateful.

Options: ReplyQuote


Subject
Views
Written By
Posted
Reorganize Partition Syntax error
3509
September 16, 2013 03:13AM
1380
September 16, 2013 09:39AM
1431
September 17, 2013 07:19PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.