14.6.5.1 CASE Syntax
14.6.5.2 IF Syntax
14.6.5.3 ITERATE Syntax
14.6.5.4 LEAVE Syntax
14.6.5.5 LOOP Syntax
14.6.5.6 REPEAT Syntax
14.6.5.7 RETURN Syntax
14.6.5.8 WHILE Syntax
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 @[email protected]+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;
时间: 2024-10-10 06:52:13