Spec-Zone .ru
спецификации, руководства, описания, API

13.7.5.11. SHOW CREATE PROCEDURE Syntax

SHOW CREATE PROCEDURE proc_name

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 13.7.5.10, "SHOW CREATE FUNCTION Syntax").

Both statements require that you be the owner of the routine 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            sql_mode:    Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1 INT)                      BEGIN                      SELECT COUNT(*) INTO param1 FROM t;                      ENDcharacter_set_client: latin1collation_connection: latin1_swedish_ci  Database Collation: latin1_swedish_cimysql> SHOW CREATE FUNCTION test.hello\G*************************** 1. row ***************************            Function: hello            sql_mode:     Create Function: CREATE FUNCTION `hello`(s CHAR(20))                      RETURNS CHAR(50)                      RETURN CONCAT('Hello, ',s,'!')character_set_client: latin1collation_connection: latin1_swedish_ci  Database Collation: latin1_swedish_ci

character_set_client is the session value of the character_set_client system variable when the routine was created. collation_connection is the session value of the collation_connection system variable when the routine was created. Database Collation is the collation of the database with which the routine is associated.