This documentation is for an older version. If you're using the most current version, select the documentation for that version with the version switch in the upper right corner of the online documentation, or by downloading a newer PDF or EPUB file. SHOW CREATE PROCEDURE Syntax


This statement is a MySQL extension. It returns the exact string that can be used to re-create the named stored procedure. A similar statement, SHOW CREATE FUNCTION, displays information about stored functions (see Section, “SHOW CREATE FUNCTION Syntax”).

To use either statement, you must be the user named in the routine DEFINER clause or have SELECT access to the mysql.proc table. If you do not have privileges for the routine itself, the value displayed for the Create Procedure or Create Function field will be NULL.

mysql> SHOW CREATE PROCEDURE test.simpleproc\G
*************************** 1. row ***************************
       Procedure: simpleproc
Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1 INT)
                  SELECT COUNT(*) INTO param1 FROM t;

mysql> SHOW CREATE FUNCTION test.hello\G
*************************** 1. row ***************************
       Function: hello
Create Function: CREATE FUNCTION `hello`(s CHAR(20))
                 RETURNS CHAR(50)
                 RETURN CONCAT('Hello, ',s,'!')