我已经多次更改此存储过程,但仍然收到相同的错误。我知道我正在取回行,因为我单独测试了游标选择。我在这个网站上阅读了其他类似的问题,但我似乎没有相同的解决方法。
DECLARE iDone INTEGER(10) DEFAULT 0;
DECLARE userID INTEGER(10);
DECLARE creditRemaining INTEGER(10);
DECLARE column_cur CURSOR FOR
SELECT `userID`, `creditRemaining` FROM `access`
WHERE (`dateExpire`>=now() OR `isRenewed`=1) and `descriptionShort`='Subscription';
DECLARE CONTINUE HANDLER FOR NOT FOUND SET iDone=1;
SET userID = 0;
SET creditRemaining = 0;
OPEN column_cur;
LOOP1: LOOP
FETCH column_cur INTO userID, creditRemaining;
IF iDone = 1
THEN
LEAVE LOOP1;
END IF;
-- SELECT userID, creditRemaining;
UPDATE `users` SET `saveCount`=creditRemaining, `searchCount`=6000 WHERE `ID`=userID;
END LOOP LOOP1;
CLOSE column_cur;