MySQL Stored Procedures-Summary Learning

Source: Internet
Author: User

Simple stored Procedure INSERT statement

BEGIN   INSERT  into VALUES (ten,3,'2013-01-02',9); #RoauDtine Body goes    here ... Select -- indicates the number of rows affected END

Simple stored Procedure ifelse statement (UserID In,username is out)

BEGIN     IFUserid=  -  Then             SETUserName= '5'; END IF; IFUserid=  -  Then             SETUserName= '4'; END IF; #Routine body goes here ...,END

The simple stored Procedure IfElse statement (UserID is In,username is out), the problem here is that the select return quantity and the results of the normal query are inconsistent, and later changed several parameters, and finally determined that the UserID and the UserID in the table repeatedly caused, And the case is indistinguishable, so change it to USERID1

BEGIN  if(username>5) Then  Select Count(*) fromUserAccountwhereUserid> -; #Routine body goes here ...ELSE  SETUserid1=4;End if ; END

MySQL Stored Procedures-Summary Learning

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.