Home > Database > Mysql Tutorial > body text

mysql循环存储过程_MySQL

WBOY
Release: 2016-06-01 13:36:00
Original
1247 people have browsed it

bitsCN.com

mysql循环存储过程

 

利用存储过程执行一批语句

DELIMITER $$

 

DROP PROCEDURE IF EXISTS `proc1`$$

 

CREATE  PROCEDURE `proc1`()

BEGIN

declare i integer;

set i=0;

while i

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()

 

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template