DROP DATABASE IF EXISTS db0; CREATE DATABASE db0; USE db0; DELIMITER § CREATE PROCEDURE create_db() BEGIN DECLARE cnt INTEGER DEFAULT 1; WHILE cnt < 100 DO SET @dropschema = CONCAT('DROP SCHEMA IF EXISTS db', cnt); PREPARE ps1 FROM @dropschema; EXECUTE ps1; SET @createschema = CONCAT('CREATE SCHEMA db', cnt); PREPARE ps2 FROM @createschema; EXECUTE ps2; SET cnt = cnt + 1; END WHILE; END§ CREATE PROCEDURE drop_db() BEGIN DECLARE cnt INTEGER DEFAULT 1; WHILE cnt < 100 DO SET @dropschema = CONCAT('DROP SCHEMA IF EXISTS db', cnt); PREPARE ps1 FROM @dropschema; EXECUTE ps1; SET cnt = cnt + 1; END WHILE; END§ DELIMITER ; CALL create_db();