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= ...
随机推荐
- 十一、模拟扫码登录微信(用Django简单的布置了下页面)发送接收消息
为了能够模拟登陆QQ,并获取信息.对扫码登录微信进行了分析.简单的用了一下Django将获取的信息映射到页面上.(python3+pycharm) 主要过程就是: 1.获取二维码 2.扫码登录(有三种 ...
- ubuntu20 使用命令安装 nginx
安装 nginx sudo apt-get install nginx -y 配置文件 nginx 服务管理 # 启动 nginx 服务 service nginx start # 关闭 nginx ...
- 【linux】基础命令一
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mount dir[] device[]umount devic[]maste ...
- MonkeyRunner+Python自动化测试一
MonkeyRunner介绍 1.monkeyrunner 工具提供了一个 API,用于编写可从 Android 代码外部控制 Android 设备或模拟器的程序.使用 monkeyrunner,您可 ...
- spring框架中配置mysql8.0需要注意的地方(转载)
8.0以后的mysql很强大,但是配置写法出现了不同 主要原因是时区不同,mysql默认用的是国外某个地方的时区,而我们要用的话用使用东八时区,这是中国统一时区. 装载自https://blog.cs ...
- DFS深度优先搜索算法
Lake Counting(POJ No.2386) 有一个大小为N*M的园子,雨后积起了水.八连通的积水被认为是在一起的.请求出园子里共有多少个水洼?(八连通是指下图中相对w的*部分) * * * ...
- 【二分图】HEOI2012 朋友圈
题目内容 洛谷链接 在很久很久以前,曾经有两个国家和睦相处,无忧无虑的生活着. 一年一度的评比大会开始了,作为和平的两国,一个朋友圈数量最多的永远都是最值得他人的尊敬,所以现在就是需要你求朋友圈的最大 ...
- sublime破解 mac版本下载
date: "2020-10-18T10:03:01+08:00" title: "sublime破解 mac版本下载" tags: ["sublim ...
- 第五章 Linux操作系统关机、重启、注销及其查看ip命令
一.更新系统时间与网络时间同步 1. 安装ntpdate工具 # yum -y install ntp ntpdate 2. 设置系统时间与网络时间同步 # ntpdate cn.pool.ntp ...
- offer_JZ25
offer_JZ25 题目:输入一个复杂链表(每个节点中有节点值,以及两个指针,一个指向下一个节点,另一个特殊指针random指向一个随机节点),请对此链表进行深拷贝,并返回拷贝后的头结点.(注意,输 ...