Mysql generates a complete Stored Procedure Definition Statement. mysql Stored Procedure

Source: Internet
Author: User

Mysql generates a complete Stored Procedure Definition Statement. mysql Stored Procedure

Select concat ('pr _ ', p. db ,'. ', p. name) FileName, CONCAT ('delimi', 'TER $ USE '', p. db, ''$ drop procedure if exists'', p. name, ''$ create definer = ', ''', LEFT (DEFINER,-1 + LOCATE (' @ ', DEFINER )),''@'', RIGHT (DEFINER, LENGTH (DEFINER)-LOCATE ('@', DEFINER), ''', 'processed', p. name, ''(', p. param_list, ')', p. body_utf8, '$ DELIMI', 'TER;') AS SQL _create FROM mysql. proc AS p WHERE p. db LIKE '%' and type like 'proc % 'order by p. db, p. name;


In MySQL, how does one write SQL statements to call stored procedures?

Call sp_add ();
Is there a problem with the process you defined, and the returned results are not pointed out?
Like me:

Create procedure sp_add (a int, B int, out c int)
Begin

Set c = a + B;

End;
Call process:
Call sp_add (1, 2, @ );
Select @;

How does mysql execute block statements without creating functions or stored procedures?

Mysql does not have the concept of blocks. Separate blocks are as follows:
BEGIN
Insert into liu_test VALUE ('A', 'bb ');
END
Such blocks cannot be executed.
The best way to execute a block separately is to create a stored procedure, and delete the stored procedure after execution.

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.