Show procedure/function code in MySql

26,076

Solution 1

try "SHOW CREATE PROCEDURE procedurename"

Solution 2

Yes,

SELECT ROUTINE_DEFINITION FROM information_schema.ROUTINES WHERE SPECIFIC_NAME='procedurename'
Share:
26,076
User129
Author by

User129

Updated on December 22, 2020

Comments

  • User129
    User129 over 3 years

    Is there any options to view stored procedure/function code in MySql same as like "sp_helptext procedurename" in sql?

  • jave.web
    jave.web about 10 years
    1. SHOW with CREATE is usually available, (just SHOW is only available in debug mode)........................ 2. This shows the whole CREATE code of the function/procedure.
  • jave.web
    jave.web about 10 years
    Also note that of course you can switch procedure keyword with function to get the function create code::::: SHOW CREATE FUNCTION function_name
  • jave.web
    jave.web about 10 years
    This shows what the function/procedure CONTAINS - what is to be executed, not the whole "create function/procedure" code.