If conditions are determined to meet different conditions and perform different operations, we only need to learn programming and know the role of if. Let's take a look at how to use if in the mysql stored procedure.
Today, let's talk aboutMysql tutorial SQL stored procedure flow control if statement usageWith the instance tutorial
If statement
If implementationCondition judgmentTo perform different operations according to different conditions, we only need to know the function of if when learning programming. Let's take a look at how to use if in the mysql stored procedure.
If contion then list
[Elseif condition then list] ......
[Else list]
End if
This looks like the conditions in the asp tutorial, but when elseif is used, it is like if in the php tutorial, but no matter what it is like, we know its usage, let's take a look at the example of an if statement.
Mysql> create procedure ifprod ()
-> Begin
-> Set @ x = 0;
-> Ins: loop;
-> Set @ x = @ x + 1;
If @ x = 100 then
Leave ins;
End if
Insert into actor (firestname) values ('www. bKjia. c0m ');
End loop ins;
End;
-> $
Query OK, 0 rows affected (0.00 sec );
A simple example is used to demonstrate the mysql SQL stored procedure.Process control ifStatement usage
The original tutorials on this site are reproduced and indicated by www. bKjia. c0m/database/database.html