mysql 中的判断语句(case、if)
来源:互联网 发布:人工智能的最新发展 编辑:程序博客网 时间:2024/05/19 02:44
此篇文章是通过存储过程来介绍的
1、if语句:
a、单分支 语法格式:
create procedure p1(参数)
begin
if 表达式 then 代码1;
end if;
end;
示例:
create procedure p1(a int)
begin
declare i int default 3;
if a>i then select "春天" as "季节" ;
end if;
end;
b、双分支语法格式
create procedure p1(参数)
begin
if 表达式 then 代码1;
else 代码 2
end if;
end;
示例:create procedure p9(a int)
begin
declare i int default 3;
if a>i then select "春天" as "季节" ;
ELSE
select "夏天" as "季节" ;
end if;
end;
语法格式:
create procedure p1(参数)
begin
case 变量 when 值 then 代码1;
when 值 then 代码2;
else 代码3;
end case;
end;
示例:
create procedure p11(a int)
begin
case a when 1 then select "夏" as "季节" ;
when 2 then select "春天" as "季节" ;
else select "秋天" as "季节" ;
end case;
end;
- mysql 中的判断语句(case、if)
- Shell中的if和case判断语句
- 数据库sql判断语句(case,IF)
- mysql的存储过程中的语句if case 循环语句
- mysql 语句中的简单if判断
- mysql 语句中的简单if判断
- MySQL的if,case语句
- MySQL中的if和case语句使用总结
- MySQL中的if和case语句使用总结
- shell中的if语句和case语句
- 判断语句switch - case 和if - else
- SQL中的IF ELSE(CASE语句的使用)
- SQL中的IF ELSE(CASE语句的使用)
- SQL中的IF ELSE(CASE语句的使用)
- SQL中的IF ELSE(CASE语句的使用)
- SQL中的IF ELSE(CASE语句的使用)
- MySQL的if,case语句使用总结
- MySQL的if,case语句使用总结
- TA-Lib在Win7系统上的安装
- 简单了解tcp/ip协议
- 树搜索策略(下)
- Centos之Go语言安装-yellowcong
- HDFS基本概念篇
- mysql 中的判断语句(case、if)
- 带宽
- 实现一个简单的shared_ptr
- 美团和滴滴面经
- yii2-RBAC-rest api开发思路
- 4.jsp隐藏对象
- CentOS 6.5系统中iptables防火墙开放端口
- JVN虚拟机结构图
- C++程序设计范例实训实训教程