MySQL(Flow Control Statements)

 

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.

 

转载于:https://www.cnblogs.com/hephec/p/4562487.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值