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.
Expand Stored Procedures, right-click the procedure and then select Script Stored Procedure as, and then select one of the following: Create To, Alter To, or Drop and Create To. Select New Query Editor Window. This will display the procedure definition.
Showing stored functions using MySQL WorkbenchStep 1. Connect to the database that you want to show the stored functions. Step 2. Open the Functions menu, you will see a list of functions which belong to the database.
Stored routines (procedures and functions) are supported in MySQL 5.0. A stored procedure is a set of SQL statements that can be stored in the server. Once this has been done, clients don't need to keep reissuing the individual statements but can refer to the stored procedure instead.
A SQL View is a virtual table, which is based on SQL SELECT query. A view references one or more existing database tables or other views. It is the snap shot of the database whereas a stored procedure is a group of Transact-SQL statements compiled into a single execution plan.
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.
You can use this:
SELECT ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = 'yourdb' AND ROUTINE_TYPE = 'PROCEDURE' AND ROUTINE_NAME = "procedurename";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With