Sp_object MYSQL obtains the content of the specified object and Definition Statement in the current instance [SQL] DELIMITER $ USE 'test' $ DROP PROCEDURE IF EXISTS 'SP _ object' $ CREATE PROCEDURE 'SP _ object '(p_OBJECTNAME VARCHAR (255 ), p_DBNAME VARCHAR (255) BEGIN/* by Chen enhui CALL example: CALL sp_object ('updatefactadgroupdailyusagebyhourly ',''); */-- Process and function SELECT 'type' AS _ type, db as dbname, 'name' as objectname, body as definition from mysql. proc a WHERE db like concat (p_DBNAME, '%') AND 'name' like concat (p_OBJECTNAME, '% ') -- AND 'type' = 'Procedure '-- table union all select 'table' AS _ type, TABLE_SCHEMA, TABLE_NAME, ''as definition from information_schema.TABLES a WHERE TABLE_SCHEMA like concat (p_DBNAME, '%') AND table_name like concat (p_OBJECTNAME, '%') -- trigger union all select 'trigger' AS _ TYPE, TRIGGER_SCHEMA as dbname, TRIGGER_NAME, ACTION_STATEMENT as definition from information_schema. 'trigger' a WHERE TRIGGER_SCHEMA like concat (p_DBNAME, '%') AND TRIGGER_NAME like concat (p_OBJECTNAME, '%') -- view union all select 'view' AS _ TYPE, TABLE_SCHEMA as dbname, TABLE_NAME AS 'viewname', VIEW_DEFINITION as definition from information_schema. 'Views 'a WHERE TABLE_SCHEMA like concat (p_DBNAME, '%') AND TABLE_NAME like concat (p_OBJECTNAME, '%') order by _ TYPE, DBNAME; END $ DELIMITER;