标签:
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 IF
, CASE
, ITERATE
, LEAVE
LOOP
, WHILE
, 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
CASEcase_value
WHENwhen_value
THENstatement_list
[WHENwhen_value
THENstatement_list
] ... [ELSEstatement_list
] END CASE
CASE WHENsearch_condition
THENstatement_list
[WHENsearch_condition
THENstatement_list
] ... [ELSEstatement_list
] END CASE
TheCASE
statement for stored programs implements a complex conditional construct.
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 CASE
instead of END
.
MySQL(Flow Control Statements)
标签:
原文地址:http://www.cnblogs.com/hephec/p/4562487.html