接着我们要讲的是关于mysql教程 存储过程case语句语法与实例教程哦,首页我们来看看case语句的简单说明,再以实例说明case的具体用法。
case语句。
case语句比起if要复杂了一些,它可以构造更复杂的条件。
Case condtion
WHEN whenvalue THEN statlist
[when value then statmentlist]
[else statmentlist]
end case
or:
case
when scontion then stlist
[when sconteiont then statlist]
[else statlst]
end case
在编程中if的大多语句可以用case 来完成,当然了case的所有作法if都能完成,下面我们来看一个case的实例教程吧。
case
when iid=2 then
set @x=@x1+dcount;
else
set @x2 = @x2+ dcount;
end case;
或者
case id
when 2 then
@x1 = @x1 + 5;
else
@x111cn.net = @x111cn.net+ 'www.111cn.net';
end case;
好了关于case语法与实例用法我们都举了一个实例说明了,如果不明白可以查看相关文章。
本站原创文章转载的朋友麻烦加上本站地址,原创不容易谢谢,
转载地址 www.111cn.net/database/database.html