mysql存储过程实例,查询多参数赋值
drop procedure if exists p_for_create_customer;
create procedure p_for_create_customer()
begin
declare ii int default 0;
declare i int default 1;
declare minss int default 0;
declare idd int;
declare start_d datetime;
declare channel_code_ VARCHAR(255);
declare end_d datetime;
declare minutes int;
select id,countt,start_date,end_date,channel_code into idd,ii,start_d,end_d,channel_code_ from schedu_create_info where is_effective='true' limit 1;
select timestampdiff(minute,start_d,end_d) into minss from dual;
select idd from dual;
loop_example : loop
update schedu_create_info set is_effective='true' where id = idd;
set i = i + 1;
insert into crm_t_customer (mobile ,name ,idcard,channel_code,create_date)
value(CONCAT('1*********',rand_num(0,9)),'***','***',channel_code_,DATE_ADD(start_d,INTERVAL rand_num(0,minss) MINUTE) );
if i >ii then
leave loop_example;
end if;
end loop;
end;
call p_for_create_customer();
drop procedure if exists p_for_create_customer;
create procedure p_for_create_customer()
begin
declare ii int default 0;
declare i int default 1;
declare minss int default 0;
declare idd int;
declare start_d datetime;
declare channel_code_ VARCHAR(255);
declare end_d datetime;
declare minutes int;
select id,countt,start_date,end_date,channel_code into idd,ii,start_d,end_d,channel_code_ from schedu_create_info where is_effective='true' limit 1;
select timestampdiff(minute,start_d,end_d) into minss from dual;
select idd from dual;
loop_example : loop
update schedu_create_info set is_effective='false' where id = idd;
set i = i + 1;
insert into crm_t_customer (mobile ,name ,idcard,channel_code,create_date)
value(CONCAT('1*********',rand_num(0,9)),'***','***',channel_code_,DATE_ADD(start_d,INTERVAL rand_num(0,minss) MINUTE) );
if i >ii then
leave loop_example;
end if;
end loop;
end;
call p_for_create_customer();
delete from crm_t_customer;
select * from schedu_create_info;
select * from crm_t_customer;
call p_for_create_customer();
select rand_num(2,54);
alter event event_task_customer ON COMPLETION PRESERVE ENABLE;
alter event event_task_customer ON COMPLETION PRESERVE DISABLE;
DROP EVENT event_task_customer;
create event event_task_customer
on schedule every 2 minute
on completion PRESERVE
do call p_for_create_customer();
mysql存储过程实例,查询多参数赋值的更多相关文章
- MySql 存储过程实例 - 转载
MySql 存储过程实例 将下面的语句复制粘贴可以一次性执行完,我已经测试过,没有问题! MySql存储过程简单实例: ...
- MySql 存储过程实例(附完整注释)(转)
MySql 存储过程实例(附完整注释) 将下面的语句复制粘贴可以一次性执行完,我已经测试过,没有问题! MySql存储过程简单实例: ...
- PHP调用MYSQL存储过程实例
PHP调用MYSQL存储过程实例 标签: mysql存储phpsqlquerycmd 2010-09-26 11:10 11552人阅读 评论(3) 收藏 举报 实例一:无参的存储过程$conn = ...
- 调用MYSQL存储过程实例
PHP调用MYSQL存储过程实例 http://blog.csdn.net/ewing333/article/details/5906887 http://www.cnblogs.com/kkchen ...
- MySql 存储过程实例(附完整注释)
将下面的语句复制粘贴可以一次性执行完,我已经测试过,没有问题! MySql存储过程简单实例: ...
- MySQL 存储过程实例 与 ibatis/mybatis/hibernate/jdbc 如何调用存储过程
虽然MySQL的存储过程,一般情况下,是不会使用到的,但是在一些特殊场景中,还是有需求的.最近遇到一个sql server向mysql迁移的项目,有一些sql server的存储过程需要向mysql迁 ...
- mysql 存储过程实例
--存储过程名和参数,参数中in表示传入参数,out标示传出参数,inout表示传入传出参数 create procedure p_procedurecode(in sumdate varchar(1 ...
- MySQL存储过程实例
一.创建MySQL数据库函数 TCC:无参数,查询fruit表中的所有数据 : TAA:两个参数,查询fruit总共有多少行:查询ids为某个值时水果表的数据 TDD:两个参数,查询ids不等于某个值 ...
- Mysql 存储过程实例详解
存储过程和函数是事先经过编译并存储在数据库中的一段SQL语句的集合,存储和和函数的区别在于函数必须有返回值,而存储过程没有,存储过程的参数可以使用IN.OUT.INOUT类型,而函数的参数只能是IN类 ...
随机推荐
- sentinel-dashboard安装、运行(ubuntu)
下载页面https://github.com/alibaba/Sentinel/releases wget -P /opt/downloads https://github.com/alibaba/S ...
- nginx+uwsgi启动Django项目
1.安装项目环境 系统环境:ubuntu16.04 python环境:python3.5.2 Django版本:django1.11.7 nginx环境:nginx_1.10.3 虚拟环境:virtu ...
- Shiro笔记(二)Shiro集成SpringMVC的环境配置
0.pom文件引入 <!-- SECURITY begin --> <dependency> <groupId>org.apache.shiro</group ...
- 【python】常用第三方模块
No1: [Pillow]图像处理标准库 缩放 from PIL import Image # 打开一个jpg图像文件,注意是当前路径: im = Image.open('test.jpg') # 获 ...
- go get 无反应、访问github.com速度慢、没反应问题的解决方案
go get 无反应.访问github.com速度慢.没反应问题的解决方案 昨天晚上装了个虚拟机,Centos7 安装都正常,网络访问也正常,但是打算安装beego的时候,把我给噎着了,无论是 ...
- 动手创建 SSD 目标检测框架
参考:单发多框检测(SSD) 本文代码被我放置在 Github:https://github.com/XinetAI/CVX/blob/master/app/gluoncvx/ssd.py 关于 SS ...
- Rendering React components to the document body
React一个比较好用的功能是其简单的API,一个组件可以简单到一个return了组件结构的render函数.除了一个简单的函数之外,我们还有了一段有用且可复用的代码片段. 问题 不过有时候可能会受到 ...
- Django 学习第四天——Django 模板标签
一.模板标签: 作用:标签在渲染的过程中提供任意的逻辑:例如 if for...in... 等 标签语法:由 {% %} 来定义的:例如:{% tag %}xxx{% endtag %} 常用标签: ...
- Summary
PDF 暑假开始准备转移博客,试了几个都不怎么满意(我还去试了下LineBlog 不知道那时候在想什么..),屯着一堆文章,,到时候一起发了 现在暂时转移至WordPress,不过还在完善中,预计.. ...
- luogu P2962 [USACO09NOV]灯Lights 高斯消元
目录 题目链接 题解 题目链接 luogu P2962 [USACO09NOV]灯Lights 题解 可以折半搜索 map合并 复杂度 2^(n / 2)*logn 高斯消元后得到每个点的翻转状态 爆 ...