MySQL SQL stored procedure Process Control if statement usage

Source: Internet
Author: User
Tags mysql tutorial php tutorial

Today we're going to talk about mysql tutorial SQL stored procedure Process Control if statement usage and instance tutorial

If statement

If the implementation of conditions to determine , to meet different conditions to perform different operations, which we learn to program all know if the role of the following, we look at the MySQL stored procedures in how to use the.

If Contion then list

[ElseIf condition then list] ...

[Else list]

End If

This looks like the conditions in the ASP tutorial, but in ElseIf there are some like the IF in the PHP tutorial, but whatever it is like we know how to use it, let's look at an 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.111cn.net ');

End Loop ins;

End

->$$

Query Ok, 0 rows Affected (0.00 sec);

All right, let's use a simple example to illustrate the specific usage of the MySQL SQL stored procedure Process Control if statement

The original site of this website is reproduced annotated from www.111cn.net/database/database.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.