View stored procedure/function definition in MySQL

Srinivas M.V. picture Srinivas M.V. · Dec 28, 2009 · Viewed 155.2k times · Source

What is the MySQL command to view the definition of a stored procedure or function, similar to sp_helptext in Microsoft SQL Server?

I know that SHOW PROCEDURE STATUS will display the list of the procedures available. I need to see a single procedure's definition.

Answer

afftee picture afftee · Dec 28, 2009
SHOW CREATE PROCEDURE <name>

Returns the text of a previously defined stored procedure that was created using the CREATE PROCEDURE statement. Swap PROCEDURE for FUNCTION for a stored function.