And then we're going to talk about the MySQL Tutorial stored procedure Case statement syntax and example tutorial Oh, home page let's look at a brief description of the case statement, and then illustrate the specific usage of the cases with an example.
Case statement.
A case statement is a bit 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, if most of the statements can be done in case, of course, all the cases of the example can be completed, let's look at an instance of the sample tutorial .
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;
All right, about case syntax and instance usage we've all given an example of how to view articles if you don't understand them.
Site original article reproduced friend trouble plus the site address, original is not easy to thank,
Reprint Address www.111cn.net/database/database.html