DROP PROCEDURE IF EXISTS x.`wk`;
DELIMITER $$
CREATE PROCEDURE `x`.`wk`()
BEGIN
DECLARE crs VARCHAR ( 500 );
DECLARE t VARCHAR ( 50 );
SET t = CONCAT( "t_track_recording_", YEAR ( CURRENT_DATE ) );
SET crs = CONCAT( "CREATE TABLE IF NOT EXISTS ", t, " like t_track_recording; " );
SET @sql = crs;
PREPARE stmt FROM @sql; -- 预处理动态sql语句
EXECUTE stmt ; -- 执行sql语句
DEALLOCATE PREPARE stmt; -- 释放prepare
END$$
CALL `x`.`wk`()
记得一定要定义delimiter $$