godot
godot

Reputation: 3545

Select stored procedure names by comment in Mysql

How can I get stored procedure names by comment in Mysql?

For example I need something like this:

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

Upvotes: 2

Views: 998

Answers (2)

Ankit Agrawal
Ankit Agrawal

Reputation: 2454

You can get the stored procedure name from information_schema using below code:

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%';

Upvotes: 4

DEarTh
DEarTh

Reputation: 1005

Yes, you can search proc by comments like this..

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

Upvotes: 1

Related Questions