您好,欢迎访问一九零五行业门户网

mysql 存储过程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;
 以上就是mysql 存储过程case语句语法与实例教程的内容。
其它类似信息

推荐信息