13.6.5 Flow Control Statements流量控制语句

13.6.5.1 CASE StatementCase语句
13.6.5.2 IF Statement语句
13.6.5.3 ITERATE Statement语句
13.6.5.4 LEAVE Statement语句
13.6.5.5 LOOP Statement语句
13.6.5.6 REPEAT Statement语句
13.6.5.7 RETURN Statement语句
13.6.5.8 WHILE Statement语句

MySQL supports the IF, CASE, ITERATE, LEAVE LOOP, WHILE, and REPEAT constructs for flow control within stored programs. MySQL支持IFCASEITERATELEAVE LOOPWHILEREPEAT构造,用于存储程序中的流控制。It also supports RETURN within stored functions.它还支持在存储函数中使用RETURN

Many of these constructs contain other statements, as indicated by the grammar specifications in the following sections. 这些构造中的许多都包含其他语句,如下面几节中的语法规范所示。Such constructs may be nested. 这种构造可以嵌套。For example, an IF statement might contain a WHILE loop, which itself contains a CASE statement.例如,IF语句可能包含WHILE循环,WHILE循环本身包含CASE语句。

MySQL does not support FOR loops.MySQL不支持FOR循环。

13.6.5.1 CASE Statement
13.6.5.2 IF Statement
13.6.5.3 ITERATE Statement
13.6.5.4 LEAVE Statement
13.6.5.5 LOOP Statement
13.6.5.6 REPEAT Statement
13.6.5.7 RETURN Statement
13.6.5.8 WHILE Statement