我有一个输入参数错误,但我不知道为什么:
0 14:31:47 call UpdateComment(66,1,2,"NOWYTitle","NOWYContent") Error Code: 1054. Unknown column 'NOWYTitle' in 'field list'
调用程序:
call UpdateComment(66,1,2,"NOWYTitle","NOWYContent");
我的程序:
DELIMITER $$
DROP PROCEDURE IF EXISTS UpdateComment $$
CREATE PROCEDURE `UpdateComment`(UserId INT,/*Crc32 int(11) unsigned,*/ArticleId int(11),CommentsId int(11), newTitle varchar(255), newContent varchar(255))
BEGIN
DECLARE helpUserTable varchar(255);
set helpUserTable = CONCAT("User",UserId);
set @score1 =CONCAT("UPDATE `",helpUserTable,"` SET Title = ",newTitle," WHERE CommentsId = ",CommentsId," AND ArticleId = ",ArticleId);
PREPARE stmt FROM @score1;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
set @score2 =CONCAT("UPDATE `",helpUserTable,"` SET Content = ",newContent," WHERE CommentsId = ",CommentsId," AND ArticleId = ",ArticleId);
PREPARE stmt FROM @score2;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END