什么是mysql的while循环中断的等价物?
WHILE (ctr < i)
DO ......
SET cnt = (SELECT COUNT(*) FROM temp_results WHERE result = "true");
IF cnt > 0 THEN
SELECT cnt;
BREAK;
END IF;
由于
答案 0 :(得分:28)
得到了它。
myloop: WHILE (ctr < i)
DO
…
SET cnt = (SELECT COUNT(*) FROM temp_results WHERE result = "true");
IF cnt > 0 THEN
SELECT cnt;
LEAVE myloop;
END IF;
END WHILE myloop;
答案 1 :(得分:15)
您可能对REPEAT
循环感兴趣:
REPEAT
SET cnt = (SELECT COUNT(*) FROM temp_results WHERE result = "true");
UNTIL cnt > 0
END REPEAT;