如何解决从游标到MySQL中数据的FETCH next语法错误?

read_loop: LOOP
FETCH next from cur1 INTO id1, userId1, major1,minor1,beaconZone1;
IF done THEN
  LEAVE read_loop;
else
  INSERT INTO test VALUES (id1, userId1, major1,minor1,beaconZone1);
END IF;
END LOOP;

最佳答案

read_loop: LOOP
FETCH next from cur1 INTO id1, userId1, major1,minor1,beaconZone1;
IF done THEN
  LEAVE read_loop;
  CLOSE cursor_name;
else
  INSERT INTO test VALUES (id1, userId1, major1,minor1,beaconZone1);
END IF;
END LOOP;

10-05 20:54