1つのエントリパラメータでエラーが発生しましたが、理由がわかりません。
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