Display description of MySQL stored procedure

MySQLMySQLi Database

To display the description of a stored procedure, following is the syntax −

SHOW CREATE PROCEDURE yourProcedureName();

Let us first create a stored procedure −

mysql> DELIMITER //
mysql> CREATE PROCEDURE sample_Procedure()
   BEGIN
      SELECT "HELLO MYSQL!!!!";
   END
   //
Query OK, 0 rows affected (0.18 sec)
mysql> DELIMITER ;

Call stored procedure using CALL command.

mysql> call sample_Procedure();

This will produce the following output −

+-----------------+
| HELLO MYSQL!!!! |
+-----------------+
| HELLO MYSQL!!!! |
+-----------------+
1 row in set (0.00 sec)
Query OK, 0 rows affected (0.01 sec)

Following is the query to display the description of MySQL stored procedure created above −

mysql> show create procedure sample_Procedure;

This will produce the following output −

+------------------+--------------------------------------------+-----------------------------------------------------------------------------------------------+----------------------+----------------------+--------------------+
| Procedure        | sql_mode                                   | Create Procedure                                                                              | character_set_client | collation_connection | Database Collation |
+------------------+--------------------------------------------+-----------------------------------------------------------------------------------------------+----------------------+----------------------+--------------------+
| sample_Procedure | STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION | CREATE DEFINER=`root`@`%` PROCEDURE `sample_Procedure`() BEGIN SELECT "HELLO MYSQL!!!!"; END | utf8 | utf8_general_ci | utf8_unicode_ci |
+------------------+--------------------------------------------+-----------------------------------------------------------------------------------------------+----------------------+----------------------+--------------------+
1 row in set (0.00 sec)
raja
Published on 22-Aug-2019 14:39:34
Advertisements