标签:
create PROCEDURE b2(in c_year int,in co int)
begin
declare num int;
if exists(select * from class where class="c_year") then
update class set code=code+1 where class="c_year";
else
insert into class(class,code)values(c_year,1);
end if;
select code into num from class where class="c_year";
select CONCAT(c_year,‘0‘,co,lpad(num,3,0)) as code_a;
end;
标签:
原文地址:http://www.cnblogs.com/mengluo/p/5400595.html