MySQL stored procedure 3:if statement

Source: Internet
Author: User

--if/else StatementsifConditions ThenSQL statementsElseSQL statements
ElseIf
SQL statementsEnd if;Create procedureTest1 ( Number int) begin if Number > Ten Then Select User(); Else Select 'Please input a number >'; End if; End$
Mysql> Create procedureTest1 ( -    Number int     - )     -   begin     -   if  Number >  Ten  Then     -     Select User();  -   Else     -     Select 'Please input a number >';  -   End if;  -   End$Query OK,0Rows Affected (0.00sec) MySQL>Call test1 () $ERROR1318(42000): Incorrect Number  ofArguments for PROCEDURETest.test1; Expected1, got0MySQL>Call Test1 ( One)$+----------------+| User()|+----------------+|Root@localhost |+----------------+1Rowinch Set(0.00sec) Query OK,0Rows Affected (0.01sec) MySQL>Call Test1 (1)$+----------------------------+|Please input a Number > Ten |+----------------------------+|Please input a Number > Ten |+----------------------------+1Rowinch Set(0.00sec) Query OK,0Rows Affected (0.01sec) MySQL>

MySQL stored procedure 3:if statement

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.