MYSQL游标循环 最后多了一行一模一样的数据
->DECLAREAREAL;->DECLAREdoneINTDEFAULTFALSE;->DECLARECUR1CURSORFORSELECTOPENFROMR_TES...
-> DECLARE A REAL;
-> DECLARE done INT DEFAULT FALSE;
-> DECLARE CUR1 CURSOR FOR SELECT OPEN FROM R_TEST.MTEST;
-> DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
-> OPEN CUR1;
-> read_loop:LOOP
-> FETCH CUR1 INTO A;
-> SELECT A;
-> IF done THEN
-> LEAVE read_loop;
-> END IF; -> END LOOP;
-> CLOSE CUR1; -> END;
-> //
最后为什么会多出一行一样的数据 展开
-> DECLARE done INT DEFAULT FALSE;
-> DECLARE CUR1 CURSOR FOR SELECT OPEN FROM R_TEST.MTEST;
-> DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
-> OPEN CUR1;
-> read_loop:LOOP
-> FETCH CUR1 INTO A;
-> SELECT A;
-> IF done THEN
-> LEAVE read_loop;
-> END IF; -> END LOOP;
-> CLOSE CUR1; -> END;
-> //
最后为什么会多出一行一样的数据 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询