MySQL存储过程的游标,可以加条件吗?
DECLARE ymd DATE;
DECLARE cur1 CURSOR FOR SELECT a1,a2 FROM schedule WHERE day=ymd;
出错:
ERROR 1337 (42000): Variable or condition declaration after cursor or handler declaration
游标里加条件判断该如何写?
------解决方案--------------------DECLARE cur1 CURSOR FOR SELECT a1,a2 FROM schedule WHERE day=ymd;
DECLARE ymd DATE;
------解决方案--------------------DECLARE cur1 CURSOR FOR SELECT a1,a2 FROM schedule WHERE day=ymd;
open cur1
DECLARE ymd DATE;
.
.
.