码迷,mamicode.com
首页 > 数据库 > 详细

MySQL(Flow Control Statements)

时间:2015-06-09 09:39:05      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:

 

Overview...

1.Case Syntax

2.If Syntax

3.Iterate Syntax

4.Leave Syntax

5.Loop Syntax

6.Repeat Syntax

7.Return Syntax

8.While Syntax

MySQL supports the IFCASEITERATELEAVE LOOPWHILE, and REPEAT constructs for flow control within stored programs. It also supports RETURN within stored functions.

MySQL does not support FOR loops.

(1)Case Syntax

CASE case_value
    WHEN when_value THEN statement_list
    [WHEN when_value THEN statement_list] ...
    [ELSE statement_list]
END CASE

CASE
    WHEN search_condition THEN statement_list
    [WHEN search_condition THEN statement_list] ...
    [ELSE statement_list]
END CASE

The CASE statement for stored programs implements a complex conditional construct.
Note

There is also a CASE expression, which differs from the CASE statement described here. See Section 12.4, “Control Flow Functions”. The CASE statement cannot have an ELSE NULL clause, and it is terminated with END CASEinstead of END.

 

MySQL(Flow Control Statements)

标签:

原文地址:http://www.cnblogs.com/hephec/p/4562487.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!