| 1 |
use test; |
| 2 |
SET @part= 'p0'; |
| 3 |
SET @part_tab= 'tp'; |
| 4 |
SET @table= 't_10'; |
| 5 |
SET @s= CONCAT('ALTER TABLE ',@part_tab,' EXCHANGE PARTITION ',@part,' WITH TABLE ',@table); |
| 6 |
PREPARE test_stmt1 FROM @s; |
| 7 |
EXECUTE test_stmt1; |
| 8 |
SELECT * FROM t_10; |
| 9 |
a b |
| 10 |
2 Two |
| 11 |
4 Four |
| 12 |
6 Six |
| 13 |
8 Eight |
| 14 |
SELECT * FROM tp; |
| 15 |
a b |
| 16 |
1 One |
| 17 |
112 Hundred twelve |
| 18 |
114 Hundred fourteen |
| 19 |
116 Hundred sixteen |
| 20 |
118 Hundred eightteen |
| 21 |
12 twelve |
| 22 |
122 Hundred twenty-two |
| 23 |
124 Hundred twenty-four |
| 24 |
126 Hundred twenty-six |
| 25 |
128 Hundred twenty-eight |
| 26 |
14 Fourteen |
| 27 |
16 Sixteen |
| 28 |
162 Hundred sixty-two |
| 29 |
164 Hundred sixty-four |
| 30 |
166 Hundred sixty-six |
| 31 |
168 Hundred sixty-eight |
| 32 |
18 Eightteen |
| 33 |
182 Hundred eighty-two |
| 34 |
184 Hundred eighty-four |
| 35 |
186 Hundred eighty-six |
| 36 |
188 Hundred eighty-eight |
| 37 |
3 Three |
| 38 |
5 Five |
| 39 |
9 Nine |
| 40 |
DEALLOCATE PREPARE test_stmt1; |
| 41 |
SET @part_tab= 'tp'; |
| 42 |
SET @s= CONCAT('ALTER TABLE ',@part_tab,' EXCHANGE PARTITION ? WITH TABLE ?'); |
| 43 |
PREPARE test_stmt2 FROM @s; |
| 44 |
ERROR 42000: 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 '? WITH TABLE ?' at line 1 |
| 45 |
DROP TABLE IF EXISTS t_10; |
| 46 |
DROP TABLE IF EXISTS t_100; |
| 47 |
DROP TABLE IF EXISTS t_1000; |
| 48 |
DROP TABLE IF EXISTS tp; |
| 49 |
DROP TABLE IF EXISTS tsp; |
| 50 |
DROP TABLE IF EXISTS tsp_00; |
| 51 |
DROP TABLE IF EXISTS tsp_01; |
| 52 |
DROP TABLE IF EXISTS tsp_02; |
| 53 |
DROP TABLE IF EXISTS tsp_03; |
| 54 |
DROP TABLE IF EXISTS tsp_04; |
| 55 |
DROP TABLE IF EXISTS t_empty; |
| 56 |
DROP TABLE IF EXISTS t_null; |