mysql遍历方式可以使用while,loop和repeat来实现,示例如下:
BEGIN DECLARE i INT DEFAULT 0; # WHILE WHILE i < 5 DO SET i = i + 1; END WHILE; # SELECT i; # LOOP optLoop:LOOP IF i > 10 THEN LEAVE optLoop; END IF; SET i = i + 1; END LOOP; # SELECT i; # REPEAT REPEAT SET i = i + 1; UNTIL i > 15 END REPEAT; SELECT i; END