SHOW CREATE PROCEDURE

SHOW CREATE PROCEDURE proc_name

The SHOW CREATE PROCEDURE statement returns the exact string used to create the specified stored procedure.

To use this statement, you must satisfy at least one of the following conditions:

  • Be the user specified as the DEFINER of the routine.
  • Have the SHOW_ROUTINE privilege.
  • Have the SELECT privilege at the global level.
  • Have the CREATE ROUTINE, ALTER ROUTINE, or EXECUTE privilege on the routine.

If you have only the CREATE ROUTINE, ALTER ROUTINE, or EXECUTE privilege, and none of the first two conditions apply, the Create Procedure field in the result set returns NULL.

For more information, see the MySQL documentation: SHOW CREATE PROCEDURE Statement.