mysql循環存儲過程 利用存儲過程執行一批語句 www.2cto.com DELIMITER $$ DROP PROCEDURE IF EXISTS `proc1`$$ CREATE PROCEDURE `proc1`() BEGIN declare i integer; set i=0; while i<=100 do begin set @TABLENAME=CONCAT('update ','sns_userinfo_ext_',i,' set mobile_flag=1,mail_flag=1;'); PREPARE STMT FROM @TABLENAME; EXECUTE STMT; SET i=i+1; end; end while; END$$ call ff()