sdasd
2024-10-19 21:31:31
create PROCEDURE v4(in c_year int)
BEGIN
declare num int(10) default 0;
declare num1 int(10);
select code into num from class where class=c_year order by code desc limit 1; IF exists(select * from class where class=c_year) THEN insert into class(class,code)values(c_year,num+1);
else
insert into class(class,code)values(c_year,1);
end if; end;
BEGIN
DECLARE a_class VARCHAR (10);
DECLARE a_code int (10);
DECLARE a_int INT (10);
SELECT IFNULL(class, class) INTO a_class;
select SUBSTR('0000',4,4)+'0' into a_code;
select a_int=a_code+1;
IF class = a_class THEN
IF a_int<10 THEN
insert into class(class,code)VALUES(a_class,CONCAT(a_class,'000',a_int));
elseIF a_int <100 THEN
insert into class(class,code)VALUES(a_class,CONCAT(a_class,'00',a_int));
elseIF a_int <1000 THEN
insert into class(class,code)VALUES(a_class,CONCAT(a_class,'0',a_int));
elseif a_int<10000 THEN
insert into class(class,code)VALUE(a_class,concat(a_class,a_int));
end if;
end if;
set a_int=a_code+1;
end
create PROCEDURE class_a(in c_year 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, lpad(num,4,0)) as code_a; end;
最新文章
- cacti监控windows服务器
- Unity官网教程之Tips
- Django 源码小剖: Django ORM 查询管理器
- json数据获取
- [FML]学习笔记三 Rademacher Complexity
- python第三方模块
- windows live writer插件说明文档(附录网盘地址)
- JQuery+CSS3实现封装弹出登录框效果
- CSS中的浮动清除
- 从零开始学JavaWeb
- 【转】 Python调用(运行)外部程序
- 痞子衡嵌入式:开启NXP-MCUBootUtility工具的HAB签名功能 - CST(中英双语)
- [Linux] Linux的环境变量
- Python学习之旅(二十五)
- Linux系列教程(四)——Linux常用命令之文件和目录处理命令
- 根据ip地址获取用户所在地
- libvlc_new 调用产生段错误
- CSS style 属性
- node.js入门基础
- 微信JS-SDK实现上传图片功能