DELIMITER //
DROP PROCEDURE IF EXISTS create_group;
CREATE PROCEDURE create_group (n INT)
BEGIN
DECLARE drop_cache VARCHAR(1000);
DECLARE str_cache VARCHAR(1000);
SET drop_cache = "DROP TABLE IF EXISTS `group`;";
SET str_cache = CONCAT(
"CREATE TABLE `group`(",
"`id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,",
"`data` VARBINARY(",
CONCAT(n,""),
")",
");"
);
SET @drop_sql = drop_cache;
SET @update_sql = str_cache;
PREPARE drop_sql FROM @drop_sql;
EXECUTE drop_sql;
PREPARE update_sql FROM @update_sql;
SET @total = n;
EXECUTE update_sql;
END;
//
时间: 2024-11-06 02:07:38