View stored procedure/function definition in MySQL

前端 未结 8 664
鱼传尺愫
鱼传尺愫 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:35

    You can use table proc in database mysql:

    mysql> SELECT body FROM mysql.proc
    WHERE db = 'yourdb' AND name = 'procedurename' ;
    

    Note that you must have a grant for select to mysql.proc:

    mysql> GRANT SELECT ON mysql.proc TO 'youruser'@'yourhost' IDENTIFIED BY 'yourpass' ;
    

提交回复
热议问题