Mysql stored procedure _ MySQL

Source: Internet
Author: User
Mysql stored procedures those things bitsCN.com 1. create stored procedures 1. basic syntax: SQL code create procedure sp_name () begin ......... End 2. parameter transfer 2. call the Stored Procedure 1. basic syntax: call sp_name () Note: the name of a stored procedure must be enclosed by brackets, even if the stored procedure has no parameters to pass. delete stored procedure 1. basic syntax: SQL code drop procedure sp_name // 2. note: (1) you cannot delete another stored procedure in one stored procedure. you can only call another stored procedure. Query the stored procedure SQL code select 'name' from mysql. proc where db = 'Your _ db_name 'and 'type' = 'processed' SQL code show PROCEDURE status displays the basic information about all stored procedures in the database, including the database to which the stored procedure belongs, the SQL code "show create procedure sp_name SQL code", such as the stored procedure name and creation Time "show create function func_name", displays details of a stored procedure. Assign values to variables using SELECT... The INTO statement assigns a value to the variable. the SQL code SELECT col_name [,...] INTO var_name [,...] table_expr example: SQL code create procedure getMsg () Begin declare v_title varchar (30); declare v_content varchar (100); select title, content into v_title, v_content from news where artId = 333; select v_title, v_content; End in the MySQL stored procedure, you can use SELECT... The INTO statement assigns a value to the variable, queries the variable in the database, and assigns the obtained result to the variable. SELECT... The syntax format of the INTO statement is as follows: col_name: name of the column field to be queried from the database; var_name: name of the variable. the column field name corresponds to the position in the column list and the variable list, assign the queried value to the corresponding variable; table_expr: the rest of the SELECT statement, including the optional FROM Clause and WHERE clause. Mysqlstorage process. zip http:///uploadfile/2012/0321/20120321090453566.zip

Author: aoyi dance bitsCN.com

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.