What would be an equivalent of a break in a while loop for mysql?
WHILE (ctr < i)
DO ......
SET cnt = (SELECT COUNT(*) FROM temp_results WHERE result = "true");
IF cnt > 0 THEN
SELECT cnt;
BREAK;
END IF;
Thanks
got it.
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;
myloop label repeated on the END WHILE statement.You might be interested in a REPEAT loop:
REPEAT
SET cnt = (SELECT COUNT(*) FROM temp_results WHERE result = "true");
UNTIL cnt > 0
END REPEAT;
REPEAT, just tested it, flawless. Thanks @p.campbell