I want to get the code used to create an existing procedure by using the command
show create procedure and then store it in a variable. All this inside a procedure.
Problem
Set @varfor creating user defined variables only works when the result contains one row and one column.show create procedure proc_namereturns multiple columns and I cant select the specific one which isCreate Function
Question
How can I save the code for creating a procedure into a variable for later use.
You can use the routines table in the information_schema database.
For more information see this link.
UPDATE:
Then you will have to build it yourself. There’s no other way.
UPDATE 2:
Considering Devart’s comment, you will have to also use the parameters table from information_schema database.
Note: This table was added with MySQL 5.5.3
For more information have a look here.
I honestly don’t know of any other way to solve this. Also I can’t update to 5.5.3 here to help you. Good luck.