List tables used inside the stored procedures in MySQL
SELECT IT.TABLE_NAME
FROM INFORMATION_SCHEMA.ROUTINES IR
JOIN INFORMATION_SCHEMA.TABLES IT ON
IR.ROUTINE_DEFINITION LIKE BINARY CONCAT("%", IT.TABLE_NAME, "%")
WHERE TABLE_SCHEMA = 'DATABASE_NAME' AND IR.ROUTINE_NAME IN
('PROCEDURE_NAME1', 'PROCEDURE_NAME2')
GROUP BY IT.TABLE_NAME;
No comments:
Post a Comment