Name

SHOW CREATE PROCEDURE

Synopsis

SHOW CREATE PROCEDURE procedure

This statement displays an SQL statement that can be used to create a stored procedure like the one given. It’s useful for displaying the SQL statements that are performed by the stored procedure.

Here is an example of a procedure that was created with the CREATE PROCEDURE statement earlier in this chapter:

SHOW CREATE PROCEDURE students_copy_proc \G

*************************** 1. row ***************************
       Procedure: students_copy_proc
        sql_mode:
Create Procedure: CREATE DEFINER=`root`@`localhost`
PROCEDURE `students_copy_proc`(IN ref_note VARCHAR(255))
BEGIN
REPLACE INTO students_backup
SELECT *, ref_note FROM students;
END

Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.