MySQL stored procedures

Source: Internet
Author: User

1. Create a stored procedure

If|  int) begin SELECT COUNT (*) from Book;end;

Call the above stored procedure (call statement invokes a program created previously with CREATE PROCEDURE)

Set @s=0; call num (@s);

Note : Specifying that the parameter is in, out, or inout is only valid for procedure. (the function parameter is always considered an in parameter) specifies that the parameter is in, out, or inout is only valid for procedure. (the function parameter is always considered an in parameter)

Returns words can only be specified for function, which is mandatory for functions. It is used to specify the return type of the function, and the body of the function must contain a return value statement.

The call statement can return a value to its caller with a parameter declared as out or the inout parameter. It also "returns" the number of rows affected, and the client program can obtain this number at the SQL level by calling the Row_count () function, which is called from C to the Mysql_affected_rows () C API function.

2. Viewing stored procedures

Show CREATE procedure num;

3. Delete stored Procedures

drop procedure num;

4. View stored Procedure Status

Show procedure status;

Or

Show procedure status like ' num% ';

MySQL stored procedures

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.