【问题标题】:Select stored procedure names by comment in Mysql在Mysql中通过注释选择存储过程名称
【发布时间】:2018-05-02 11:01:20
【问题描述】:

如何在 Mysql 中通过注释获取存储过程名称?

例如我需要这样的东西:

    SELECT *
    FROM stored_procedures
    WHERE comment LIKE '%something%''

【问题讨论】:

    标签: mysql select stored-procedures


    【解决方案1】:

    您可以使用以下代码从information_schema 获取存储过程名称:

    SELECT routine_schema,      -- database/schema wherein the object resides
           routine_name,        -- the name of the function/procedure
           routine_type,        -- PROCEDURE indicates a procedure, FUNCTION indicates a function
           routine_definition   -- code underlying the sp
           routine_comment      -- some human readable comment on the routine
      FROM information_schema.routines
      WHERE routine_comment LIKE '%test%';
    

    【讨论】:

      【解决方案2】:

      是的,您可以像这样通过 cmets 搜索 proc..

      SELECT mysql.proc.name
      FROM mysql.proc
      WHERE mysql.proc.comment LIKE '%abc%';
      

      【讨论】:

      • 这是 SQLSERVER 的答案吗?
      • 在 mysql 错误 1109 (42S02) 中没有语法:information_schema 中的未知表 'proc'
      • 它现在可以工作了,因为你已经编辑了它以包含 mysql,尽管它可能需要被限定。
      猜你喜欢
      • 1970-01-01
      • 2010-12-15
      • 1970-01-01
      • 2017-08-25
      • 2010-12-10
      • 2011-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多