CASE 用法:
两种用法:
IF 用法:
循环语句:
ITERATE Syntax
ITERATE 仅用于Loop,repeat,while 中;ITERATE,指下一次循环开始。
14.6.5.4 LEAVE Syntax
LEAVE label,退出控制流。
LEAVE can be used within BEGIN ... END or loop constructs (LOOP, REPEAT, WHILE).
Loop,
REPEAT,
delimiter //
create procedure dorepeat(p1 int)
begin
set @x=0;
repeat
set @x=@x+1;
until @x>p1
end repeat;
select @x;
end //
call dorepeat(1000);
WHILE,
CREATE PROCEDURE dowhile()
BEGIN
DECLARE v1 INT DEFAULT 5;
WHILE v1 > 0 DO
...
SET v1 = v1 - 1;
END WHILE;
END;