mysql 存储过程如何实现递增
巴扎黑
巴扎黑 2017-04-17 14:01:05
0
0
512

mysql的存储过程,如果实现递增
比如 下面的sql

DELIMITER //
drop procedure if exists p_loop//
CREATE PROCEDURE p_loop()
begin

 declare v INT;
 set v = 0;
 loop_label : LOOP
 UPDATE project_info SET project_code = (select concat('1','1',100+v)from dual) where dept_id = 1;
 set v = v+1;
    select v from dual;
 if v >= 33 then
 leave loop_label;

end if;
end loop;
end;
CALL p_loop();

我想让v自增到33,如何实现?

巴扎黑
巴扎黑

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!