No cache version.


Caching disabled. Default setting for this page:enabled (code DEF204)
If the display is too slow, you can disable the user mode to view the cached version.

Rechercher dans le manuel MySQL

13.7.6.27 SHOW PROCEDURE CODE Syntax

  1. SHOW PROCEDURE CODE proc_name

This statement is a MySQL extension that is available only for servers that have been built with debugging support. It displays a representation of the internal implementation of the named stored procedure. A similar statement, SHOW FUNCTION CODE, displays information about stored functions (see Section 13.7.6.19, “SHOW FUNCTION CODE Syntax”).

To use either statement, you must have the global SELECT privilege.

If the named routine is available, each statement produces a result set. Each row in the result set corresponds to one instruction in the routine. The first column is Pos, which is an ordinal number beginning with 0. The second column is Instruction, which contains an SQL statement (usually changed from the original source), or a directive which has meaning only to the stored-routine handler.

  1. mysql> DELIMITER //
  2. mysql> CREATE PROCEDURE p1 ()
  3.     -> BEGIN
  4.     ->   DECLARE fanta INT DEFAULT 55;
  5.     ->   DROP TABLE t2;
  6.     ->   LOOP
  7.     ->     INSERT INTO t3 VALUES (fanta);
  8.     ->     END LOOP;
  9.     ->   END//
  10. Query OK, 0 rows affected (0.00 sec)
  11.  
  12. mysql> SHOW PROCEDURE CODE p1//
  13. +-----+----------------------------------------+
  14. | Pos | Instruction                            |
  15. +-----+----------------------------------------+
  16. |   0 | set fanta@0 55                         |
  17. |   1 | stmt 9 "DROP TABLE t2"                 |
  18. |   2 | stmt 5 "INSERT INTO t3 VALUES (fanta)" |
  19. |   3 | jump 2                                 |
  20. +-----+----------------------------------------+
  21. 4 rows in set (0.00 sec)

In this example, the nonexecutable BEGIN and END statements have disappeared, and for the DECLARE variable_name statement, only the executable part appears (the part where the default is assigned). For each statement that is taken from source, there is a code word stmt followed by a type (9 means DROP, 5 means INSERT, and so on). The final row contains an instruction jump 2, meaning GOTO instruction #2.


Find a PHP function

Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-show-procedure-code.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:en Manuel MySQL : https://dev.mysql.com/

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut