Mysql Stored Procedures

Source: Internet
Author: User
Stored Procedures

???? Store multiple steps to complete a feature to define multiple calls at once.

???? is a function that has no return value.

Create

1th Step: Change Terminator

2nd step: Create a process

???? CREATE PROCEDURE procedure name ( direction parameter 1 type, direction parameter 2 type ...)

???? Begin

???????? --Process body

???? End

3rd Step: Restore Terminator

Direction of the formal parameter:

Ins

Out

InOut

Example:

To view stored procedures:

Show procedure status;

Example:

Calls to Stored procedures

Syntax

???? Call Procedure name (argument);

Example:

The formal parameter direction of the process

In???????? Indicates that data can only be passed to formal parameters, not outgoing

Out???????? Indicates that data can only be passed out, but cannot receive data that is passed in

InOut???? That is, you can receive incoming data, and you can pass the data out.

Out and InOut are reference methods, so a variable must be used for a formal parameter corresponding to an out and inout type.

Example 1:

The difference between a function and a stored procedure:

1. function must have return

2. Stored procedure cannot have return

3, function body can not have select

4. The stored procedure body can have select

5. Function parameters have no direction

6, the parameter of the stored procedure has the direction

Mysql Stored Procedures

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.