Next we will talk about the mysql stored procedure case statement syntax and instance tutorial. on the home page, let's take a look at the simple description of the case statement, and then explain the specific usage of the case with examples.
Next we will talk aboutMysql tutorial stored procedure case statement syntax and example tutorialOh, let's take a look at the simple description of the case statement on the homepage, and then use the example description.Case.
Case statement.
The case statement is more complex than the if statement. 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 of the if statements can be completed using case. Of course, all case statements can be completed using case. Let's take a look at the 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
@ XbKjia. c0m = @ xbKjia. c0m + 'www. bKjia. c0m ';
End case;
Let's take an example of the case syntax and instance usage. If you do not understand it, you can refer to the relevant articles.
The original Article reposted on this site may be difficult. Thanks,
Reprinted at www. bKjia. c0m/database/database.html