sdasd
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;
sdasd的更多相关文章
- C语言、结构体 定义
C语言允许用户自己建立由 不同类型数据组成的组合型数据结构 成为结构体. struct Student { int num; //学号 ]; //姓名为字符串 char sex; //性别为字符型 i ...
- swift_简单值 | 元祖 | 流程控制 | 字符串 | 集合
//: Playground - noun: a place where people can play import Cocoa var str = "Hello, playground& ...
- web自动化框架之四测试报告的搭建
现状: 看过前面的文章,楼主用的是python,所以在搭建测试报告这块的时候使用的是unittest+htmlTestRunner:然后发现生成出来的报告,总是有那么不完美的地方,比如想增加图片,比如 ...
- 跟我一起学ruby (转)
跟我一起学ruby By Tiger 注:本教程转载自在游戏先行者论坛,版权属于作者Tiger. 第一篇 第二篇 第一篇 自序 从今天起我就要开始学Ruby了.怎么样,没见吧?一个新人写教程.就凭我坚 ...
- python-大话装饰器
装饰器 装饰器是个什么玩意呢?是个会了不难,装逼神器.但是如果不了解理解起来还是很抽象,让我们试试这个装逼神器吧! 1.什么是装饰器 装饰器是一个很著名的设计模式,经常被用于有切面需求的场景,较为经典 ...
- display:table 水平居中
<div style="width:auto; margin:auto;display:table"> <div style="width: 100px ...
- go语言获取变量的数据类型
package main import "fmt" import "reflect"; var y string = "sdasd" fun ...
- php隔行换色输出表格
<?php header("Content-type:text/html;charset=utf-8"); $str=''; $str.='<table border= ...
- php后台拼接输出table表格
<?php header("Content-type:text/html;charset=utf-8"); $str=''; $str.='<table border= ...
随机推荐
- Java之ConcurrentHashMap源码解析
ConcurrentHashMap源码解析 目录 ConcurrentHashMap源码解析 jdk8之前的实现原理 jdk8的实现原理 变量解释 初始化 初始化table put操作 hash算法 ...
- 草率了,又一个Maven打包的问题
经常遇到 Maven 相关的问题,这是之前的文章: 这个 Maven 依赖的问题,你敢说你没遇到过:https://mp.weixin.qq.com/s/SzBbDtyRUrk_7LH8SUbGXQ ...
- gitlab介绍
1. GitLab简介 GitLab是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目. GitLab拥有与G ...
- 使用appium后安卓手机无法调出键盘解决方法
问题:用appium进行真机调试后,使用手机的app进行输入时无法调出键盘. 原因:appium调试时,将手机输入法设置成了Unicode IME 解决方法: 方法一,手机设置里修改输入法: 不同的手 ...
- ASP.Net Core3.1 生成二维码填坑
ASP.Net Core3.1 使用QrCode生成二维码 部署到Linux报错 The type initializer for 'System.DrawingCore.GDIPlus' threw ...
- centOS7 查看防火墙状态 开放端口
一.防火墙的开启.关闭.禁用命令 (1)设置开机启用防火墙:systemctl enable firewalld.service (2)设置开机禁用防火墙:systemctl disable fire ...
- php休眠微秒
<?php $child = new \Swoole\Process(function(){ while(true){ echo date("Y-m-d H:i:s").PH ...
- Linux+Nginx/Apache下的PHP exec函数执行Linux命令
1.php.ini配置文件 打开PHP的配置文件,里面有一行 disable_function 的值,此处记录了禁止运行的函数,在里面将exec和shell_exec.system等函数删除. 2.权 ...
- mac保存远程链接
安装sshpass,前提是已经安装好iterm2 下载地址:http://sourceforge.net/projects/sshpass/files/ 百度网盘:https://pan.baidu. ...
- T-sql语句,group by 加 order by的使用方法
select AuHousesID,sum(Turnover) from Auction group by AuHousesID order by sum(Turnover) desc