MySQL

How to show all stored procedures/functions in MySQL

In this tutorial, we are going to see how to show all stored procedures/functions in a MySQL database.
 

Show all stored procedures in MySQL
SHOW PROCEDURE STATUS;

Output:

+-----------+----------------+-------------+-----------------+
|    Db     |      Name      |    Type     |      Definer    |
+-----------+----------------+-------------+-----------------+
| schoolDB  |  get_students  |  PROCEDURE  | root@localhost  |
| schoolDB  |  get_profs     |  PROCEDURE  | root@localhost  |
| schoolDB  |  get_max_mark  |  PROCEDURE  | root@localhost  |
| studentDB |  get_name      |  PROCEDURE  | root@localhost  |
| studentDB |  get_address   |  PROCEDURE  | root@localhost  |
+-----------+----------------+-------------+-----------------+
 
The statement SHOW PROCEDURE STATUS displays all the characteristics of the stored procedures, including their names. It returns the stored procedures that you have the privilege to access.
 

Show all stored procedures specific to a database in MySQL
SHOW PROCEDURE STATUS WHERE Db = 'studentDB';

Output:

+-----------+----------------+-------------+-----------------+
|    Db     |      Name      |    Type     |      Definer    |
+-----------+----------------+-------------+-----------------+
| studentDB |  get_name      |  PROCEDURE  | root@localhost  |
| studentDB |  get_address   |  PROCEDURE  | root@localhost  |
+-----------+----------------+-------------+-----------------+
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *