/ Published in: MySQL
droptableslike(pattern, db)
Expand |
Embed | Plain Text
USE osamos2; delimiter $$ CREATE PROCEDURE drop_tables_like(pattern VARCHAR(255), db VARCHAR(255)) BEGIN SELECT @str_sql:=CONCAT('drop table ', group_concat(table_name)) FROM information_schema.tables WHERE table_schema=db AND table_name LIKE pattern; prepare stmt FROM @str_sql; execute stmt; DROP prepare stmt; END$$ CALL drop_tables_like('ALT_%', 'osamos2')$$ DROP PROCEDURE if EXISTS drop_tables_like$$ delimiter ;
You need to login to post a comment.
