mysql中的UPDATE存储过程

时间:2018-11-20 21:00:07

标签: mysql stored-procedures

我已经按照以下Mysql存储过程编写了两个输入参数(id和标签)

SET @sql = Concat('UPDATE tbl_Members SET TagId=CONCAT(TagId,''',tags,''') WHERE MemberID IN (',ids,')');PREPARE stmt FROM @sql;EXECUTE Stmt;

enter image description here

当我尝试执行该操作时,它会引发以下错误

The following query has failed: "CREATE DEFINER=`0zrt`@`localhost` PROCEDURE `update_member_tag`(IN `ids` VARCHAR(255), IN `tags` VARCHAR(255)) NOT DETERMINISTIC MODIFIES SQL DATA SQL SECURITY DEFINER SET @sql = CONCAT('UPDATE tbl_Members SET TagId=CONCAT(TagId,''',tags,''') WHERE MemberID IN (',ids,')'); PREPARE stmt FROM @sql; EXECUTE stmt;"
MySQL said: #1064 - 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 'PREPARE stmt FROM @sql; EXECUTE stmt' at line 2

0 个答案:

没有答案