To loop through data in a stored procedure with LOOP, you can use the following sample syntax:
[beginlabel:] LOOP
sql statements
END LOOP [endlabel];
To loop through data in a stored procedure with REPEAT, you can use the following sample syntax:
[beginlabel:] REPEAT
sql statements
UNTIL condition
END REPEAT [endlabel]
To loop through data in a stored procedure with WHILE, you can use the following sample syntax:
[beginlabel:]
WHILE condition DO
sql statements
END WHILE
[end_label]