Created
August 24, 2016 08:55
-
-
Save zeayes/0bad0622586f2cbad40f57fe878bbd6e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELIMITER $$ | |
DROP PROCEDURE IF EXISTS p1 $$ | |
CREATE PROCEDURE p1 (name CHAR(250)) | |
BEGIN | |
SET @tablename = CONCAT('table_', name); | |
SET @d = CONCAT('DROP TABLE IF EXISTS ', @tablename); | |
PREPARE dm FROM @d; | |
EXECUTE dm; | |
SET @c = CONCAT('CREATE TABLE ', @tablename, '(`id` INT PRIMARY KEY)'); | |
PREPARE cm FROM @c; | |
EXECUTE cm; | |
END $$ | |
DELIMITER ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment