MySQL 5.0 stored Procedure Learning Summary

Source: Internet
Author: User

I. Creating a stored Procedure

1. Basic grammar:

CREATE PROCEDURE Sp_name ()

Begin

.........

End

2. Parameter transfer

Two. Call the stored procedure

1. Basic syntax: Call Sp_name ()

Note: The stored procedure name must be followed by parentheses, even if the stored procedure has no parameter passing

Three. Delete stored procedures

1. Basic grammar:

drop procedure sp_name//

2. Matters needing attention

(1) cannot delete another stored procedure in one stored procedure, can only call another stored procedure

Four. blocks, conditions, loops

1. Block definition, commonly used

Begin

......

End

You can also alias a block, such as:

Lable:begin

...........

End lable;

You can use leave lable to jump out of blocks and execute code after blocks

2. Conditional statement

以下为引用的内容:
if 条件 then
statement
else
statement
end if;

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.