0
我有以下存储过程:MySQL的存储过程预处理语句不工作
CREATE PROCEDURE getLastValueAutomaticShelter(IN fieldName varchar(30), position_number INT)
BEGIN
SET @query = CONCAT('SELECT * FROM automatic_changes WHERE',fieldName,'IS NOT NULL AND P_id=?');
PREPARE stmt FROM @query;
SET @position_number=position_number;
EXECUTE stmt USING @position_number;
DEALLOCATE PREPARE stmt;
END
然后我运行它:
mysql> call getLastValueAutomaticShelter('current_level', 500)//
并获得以下错误:
ERROR 1064 (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 'NOT N
ULL AND P_id=?' at line 1
任何想法?谢谢。
谢谢配合:) – MichalB 2014-11-03 09:38:24