1

I have the following procedure:

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

But MySQL gives me the following error:

#1193 - Unknown system variable 'currDay' 

Why would this be?

4

1 回答 1

2

用户定义的变量必须以@

SET @currDay = fromdate, @endDAY = todate;
于 2013-07-06T17:45:16.147 回答