I have tried to write MySQL procedure to delete all data in the DB:
MySQL Server version 5.5.20
It looks like:
DELIMITER $$
CREATE PROCEDURE drop_data_like(pattern VARCHAR(255), db VARCHAR(255))
begin
    DECLARE truncate_table VARCHAR(255) DEFAULT '';
    DECLARE done INT DEFAULT 0;
    DECLARE cur1 CURSOR FOR SELECT CONCAT(db, '.', info.table_name)
        FROM information_schema.tables AS info
        WHERE info.table_schema=db AND info.table_name LIKE pattern;
    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
    OPEN cur1;
    read_loop: LOOP
        FETCH cur1 INTO truncate_table;
        IF done THEN LEAVE read_loop; END IF;
        PREPARE stmt FROM truncate_table;
        EXECUTE stmt;
        DROP PREPARE stmt;
    END LOOP;
    CLOSE cur1;
END$$
DELIMITER ;
CALL drop_data_like('%%', DATABASE());
DROP PROCEDURE drop_data_like;
And as the result it has showed error:
ERROR 1064 (42000) at line 16: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@truncate_table;
    IF done THEN LEAVE read_loop; END IF;
    PREPARE ' at line 13
What have I done wrong?
 
     
    