我有以下程序:
CREATE PROCEDURE incDate(fromdate date, todate date)
SET currDay = fromdate;
SET endDAY = todate;
REPEAT
SET currDay = DATE_ADD(currDay, INTERVAL 1 DAY);
INSERT INTO `dentists`.`dayT` (`day`) VALUES (currDay);
UNTIL currDay > endDAY END REPEAT;
END
但是MySQL给了我以下错误:
#1193 - Unknown system variable 'currDay'
为什么会这样?
答案 0 :(得分:2)
User-defined variables must be prefixed with @
SET @currDay = fromdate, @endDAY = todate;