Check Tables / Views dependent on Procedure/Function in MySQL
Check the list of tables dependent on Procedure/Function in MySQL or MariaDB.
SELECT a.routine_name,b.table_name,a.routine_schema,a.routine_type
FROM information_schema.ROUTINES a
INNER JOIN (SELECT table_name , table_schema
FROM information_schema.tables
) b
ON a.ROUTINE_DEFINITION LIKE concat('%',b.table_name,'%')
where b.table_schema = 'dbname' and a.ROUTINE_NAME = 'myprocedure';
Check the view dependence on Procedure/Function in MySQL or MariaDB
SELECT a.routine_name,b.table_name,a.routine_schema,a.routine_type
FROM information_schema.ROUTINES a
INNER JOIN (SELECT table_name , table_schema
FROM information_schema.views
) b
ON a.ROUTINE_DEFINITION LIKE concat('%',b.table_name,'%')
where b.table_schema = 'dbname' and a.ROUTINE_NAME = 'myprocedure'