[ACCEPTED]-Show procedure/function code in MySql-procedure

Accepted answer
Score: 18

try "SHOW CREATE PROCEDURE procedurename"

0

Score: 7

Yes,

SELECT ROUTINE_DEFINITION FROM information_schema.ROUTINES WHERE SPECIFIC_NAME='procedurename'

0

Score: 0

You can get the information form the INFORMATION_SCHEMA.ROUTINES table

0

Score: 0

I've been experimenting a bit, and I think 7 one of the following two works best.

To list 6 everything (parameters, collating, etc.), use this.

 SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA in (SELECT DATABASE()) AND ROUTINE_NAME='ProcedureName';

To list 5 only the code, use this.

SELECT ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA in (SELECT DATABASE()) AND ROUTINE_NAME='ProcedureName';

In both of the above, the 4 nested select is required to limit the result 3 to the current database, since INFORMATION_SCHEMA, being the 2 system database, contains details for every 1 database installed in the instance.

Score: 0

Go to mySQL workbench

  • Right click on procedure and then select ALTER. (This Will open the definition of procedure for you(is the easiest way).

OR

  • You can also use the command, SHOW CREATE PROCEDURE proc_name;

0

More Related questions