Sinsinw
Sinsinw
采纳率0%
2018-03-07 09:44 阅读 2.2k

mysql1241什么问题???

5

BEGIN
DECLARE k INT ;
DECLARE m INT ;
DECLARE n FLOAT ;

DECLARE CONTINUE HANDLER FOR SQLEXCEPTION,NOT FOUND,SQLWARNING SET flag=500;

SET @str1='UPDATE excel SET ard = CONCAT(`ard`,",1") WHERE `name` IN ';
SET @str1=CONCAT(@str1,snames);
PREPARE stmt1 FROM @str1;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;

SET @str2='UPDATE excel SET ard = CONCAT(`ard`,",0") WHERE `name` NOT IN ';
SET @str2=CONCAT(@str2,snames);
PREPARE stmt2 FROM @str2;
EXECUTE stmt2;
DEALLOCATE PREPARE stmt2;

UPDATE excel SET dates=CONCAT(dates,',',`datess`);

SELECT LENGTH(excel.`ard`)-LENGTH(REPLACE(excel.`ard`,'1','')) INTO k FROM excel ;

SELECT LENGTH(excel.`ard`)-LENGTH(REPLACE(excel.`ard`,',','')) INTO m FROM excel ;

SET n=CONCAT(ROUND(m/(k+1) * 100, 2),'','%')  ;

UPDATE excel SET ardrate=n;

IF flag=500 THEN ROLLBACK;
ELSE SET flag=200;
END IF;

END$$
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • mango_love mango_love 2018-03-07 09:43

    这个里面有很多中文的引号啊,肯定执行报错的。。。符号一定要用英文符号

    点赞 评论 复制链接分享
  • wxjljl wxjljl 2018-03-07 10:34

    错误:1241 SQLSTATE: 21000 (ER_OPERAND_COLUMNS)

    消息:操作数应包含%d列。

    点赞 评论 复制链接分享

相关推荐