View stored procedure/function definition in MySQL

前端 未结 8 666
鱼传尺愫
鱼传尺愫 2020-12-23 02:14

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 SH

相关标签:
8条回答
  • 2020-12-23 02:52

    If you want to know the list of procedures you can run the following command -

    show procedure status;
    

    It will give you the list of procedures and their definers Then you can run the show create procedure <procedurename>;

    0 讨论(0)
  • 2020-12-23 02:55

    something like:

    DELIMITER //
    
    CREATE PROCEDURE alluser()
    BEGIN
       SELECT *
       FROM users;
    END //
    
    DELIMITER ;
    

    than:

    SHOW CREATE PROCEDURE alluser
    

    gives result:

    'alluser', 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER', 'CREATE DEFINER=`root`@`localhost` PROCEDURE `alluser`()
    BEGIN
       SELECT *
       FROM users;
    END'
    
    0 讨论(0)
提交回复
热议问题