问题:使用cursor进行嵌套循环查询,然后第二个循环的数量不对
换成了while, 但是不明白为啥不对(写存储过程真恶心啊
代码:
DECLARE cur CURSOR FOR SELECT....
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
OPEN cur;
read_loop:
LOOP
.....
BEGIN
DECLARE cur2 CURSOR FOR SELECT....
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done2 = TRUE;
OPEN cur2;
read_loop:
LOOP
.....
END LOOP;
CLOSE cur2;
END;
END LOOP;
CLOSE cur;