case statement. The
case statement is more complicated than if, and it can construct more complex conditions.
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
In programming, most if statements can be completed using case. Of course, all the methods of case can be completed by if. Let's take a look at an example tutorial of case.
case
when iid=2 then
set @x=@x1+dcount;
else
set @x2 = @x2+ dcount ;
end case;
or
case id
when 2 then
@x1 = @x1 + 5;
else
@x111cn.net = @x111cn.net+ 'www.111cn.net';
end case;
The above is the mysql stored procedure case statement syntax and examples For the content of the tutorial, please pay attention to the PHP Chinese website (www.php.cn) for more related content!