标签:procedure prim primary declare 数据表 长度 rom cut exist
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;
//
标签:procedure prim primary declare 数据表 长度 rom cut exist
原文地址:http://www.cnblogs.com/qufanblog/p/6237373.html