DELIMITER $$
USE `vos_manager`$$
DROP PROCEDURE IF EXISTS `test_proceduce_alter_table`$$
CREATE DEFINER=`hmj_user`@`%` PROCEDURE `test_proceduce_alter_table`()
BEGIN
DECLARE msql VARCHAR(1000);
DECLARE startime VARCHAR(50);
DECLARE endtime VARCHAR(50);
SET @startime="20151001";
SET @endtime="20151003" ;
WHILE @startime<=@endtime DO
SET @msql=CONCAT('alter table vos_flow_line_distribution_monitor_',@startime,' add sex varchar(8) comment \'新添加的字段\'');
SET @startime=@startime+1;
PREPARE stm FROM @msql;
EXECUTE stm;
COMMIT;
END WHILE;
END$$
DELIMITER ;
mysql 存储过程
最新推荐文章于 2024-11-02 21:45:35 发布