MySQL - 5.1 Reference Manual参考手册 - 12.8.6.2. CASE Statement - CASE语句
CASE case_value
WHEN when_value
THEN statement_list
[WHEN when_value
THEN statement_list
] ...
[ELSE statement_list
]
END CASE
Or:
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. If a search_condition
evaluates to true, the corresponding SQL statement list is
executed. If no search condition matches, the statement list in
the ELSE
clause is executed. Each
statement_list
consists of one or
more statements.
If no when_value
or
search_condition
matches the value
tested and the
CASE
statement contains no ELSE
clause, a
Case not found for CASE statement error
results.
Each statement_list
consists of one
or more statements; an empty
statement_list
is not allowed. To
handle situations where no value is matched by any
WHEN
clause, use an ELSE
containing an empty BEGIN ... END
block, as
shown in this example:
DELIMITER |
CREATE PROCEDURE p()
BEGIN
DECLARE v INT DEFAULT 1;
CASE v
WHEN 2 THEN SELECT v;
WHEN 3 THEN SELECT 0;
ELSE
BEGIN
END;
END CASE;
END;
|
(The indentation used here in the ELSE
clause
is for purposes of clarity only, and is not otherwise
significant.)
Note
The syntax of the
CASE
statement used inside stored programs
differs slightly from that of the SQL
CASE
expression described in
Section11.3, “Control Flow Functions”. The
CASE
statement cannot have an ELSE NULL
clause,
and it is terminated with END CASE
instead
of END
.
[MySQL - 5.1 Reference Manual 参考手册 - 12 SQL Statement Syntax
- SQL语句语法 - 12.8 MySQL Compound-Statement Syntax - MySQL复合语句语法 - 12.8.6
Flow Control Constructs流程控制结构 -12.8.6.2. CASE Statement - CASE语句 - 文档]
http://dev.mysql.com/doc/refman/5.1/en/case-statement.html
[MySQL - 5.1 Reference Manual参考手册]
MySQL
- 5. 数据库管理 - 5.3. mysqld:MySQL服务器 - 5.3.3. 服务器系统变量 -
max_allowed_packet,
http://dev.mysql.com/doc/refman/5.1/zh/database-administration.html#server-system-variables
9.
语言结构 - 9.2. 数据库、表、索引、列和别名 - 9.2.2. 识别符大小写敏感性,
http://dev.mysql.com/doc/refman/5.1/zh/language-structure.html#name-case-sensitivity
13. SQL语句语法 - 13.1.数据定义语句 - 13.1.5.CREATE TABLE语法, http://dev.mysql.com/doc/refman/5.1/zh/sql-syntax.html#create-table
12
SQL Statement Syntax - SQL语句语法 - 12.8 MySQL Compound-Statement Syntax -
MySQL复合语句语法 - 12.8.6 Flow Control Constructs流程控制结构 -12.8.6.2. CASE
Statement - CASE语句,
http://dev.mysql.com/doc/refman/5.1/en/case-statement.html
分享到:
相关推荐
mysql-connection-java-5.1-bin-jar
mysql-5.1-zh手册.zipmysql-5.1-zh手册.zipmysql-5.1-zh手册.zipmysql-5.1-zh手册.zip
MySQL 5.1参考手册 前言 1. 一般信息 2. 安装MySQL 3. 教程 4. MySQL程序概述 5. 数据库管理 6. 中的复制 7. 优化 8. 客户端和实用工具程序 9.语言结构 10. 字符集支持 11. 列类型 12. 函数和操作符 13. SQL语句语法...
mysql-connector-odbc-5.1最好用的版本全集 mysql-connector-odbc-5.1.8-winx64.msi及 mysql-connector-odbc-5.1.11-win32.msi
MySQL 5.1 Reference Manual
mysql-connector-java-5.1.rar,2014版本
MySQL 5.1 Reference Manual 不错的参考手册,而且可以帮助我们学习英语。
这是关于5.1版至5.1.2-alpha版MySQL数据库系统的参考手册. 本压缩包内共含有两个chm格式文件: MySQL 5.1中文参考手册(CHM).chm MySQL 5.1英文参考手册(CHM).chm 其中文为翻译版本,均来自互联网,为了节省大家的...
本文讲述了java WEB开发参考资料MYSQL。
mysql-connector-java-5.1.46-bin.jar mysql-connector-java-5.1.27-bin.jar
mysql-refman-5.1-zh.html-chapter.zip mysql官网上下载的帮助文档
mysql-shared-5.1.7.0-i386.rpm
MySQl-5.1 中文手册 这是MySQL参考手册 它涉及MySQL 5.1至5.1.2-alpha版本
refman-5.1-zh.html-chapter.zip
mysql参考手册 mysql最新参考手册 mysql-refman-5.1-zhmysql-refman-5.1-zhmysql-refman-5.1-zhmysql-refman-5.1-zhmysql-refman-5.1-zhmysql-refman-5.1-zh
mysql5.1 参考手册 英文版
mysql-connector-java-5.1.44.7zmysql-connector-java-5.1.44.7zmysql-connector-java-5.1.44.7z
mysql-5.1中文手册,很用用的,翻译的还可以!
mysql-connector-java-5.1.30-bin.jar mysql-connector-java-5.1.39-bin.jar mysql-connector-java-5.1.45-bin.jar mysql-connector-java-5.1.46-bin.jar 连接数据库的过程中会用到该jar包,可以根据你的项目来选择...
数据库软件安装 - MySQL-5.1 安装配置图解.docx