1

发生了非常奇怪的错误。我有一个在 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

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

4

0 回答 0