首页 > mysql 存储过程如何实现递增

mysql 存储过程如何实现递增

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,如何实现?

【热门文章】
【热门文章】