"正确的语法使用近' 0'在第1行"在存储过程中

时间:2013-03-11 18:25:04

标签: mysql stored-procedures

非常奇怪的错误发生。我有一个在Live Server(MySQL v.5.5.12)上正常工作的存储过程,但在本地(v.5.5.25a)我收到错误。这是存储过程

DELIMITER $$
DROP PROCEDURE IF EXISTS `SaveIDForTable`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `SaveIDForTable`(IN OffID varchar(100),IN TabName VARCHAR(255))
    DETERMINISTIC
BEGIN
set @sql='create table if not exists '||TabName||'(ID bigint(20) NOT NULL,exp date not null,PRIMARY KEY (ID))';
PREPARE statment FROM @sql;
EXECUTE statment;
DEALLOCATE PREPARE statment;
set @sql='insert ignore into '||TabName||' select ID,curdate() from all_data where Official_ID=\''||OffID||'\'';
PREPARE statment FROM @sql;
EXECUTE statment;
DEALLOCATE PREPARE statment;
END$$

但是当我运行存储过程时

CALL SaveIDForTable ('203200702000000-207-5C2FF0','testTable') 

我收到错误

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 '0' at line 1

我已尝试在我的本地计算机上运行其他存储过程并且它们工作正常,但由于某种原因我无法开始工作。任何帮助将不胜感激。

0 个答案:

没有答案