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存储过程实例,查询多参数赋值的更多相关文章

  1. MySql 存储过程实例 - 转载

    MySql 存储过程实例 将下面的语句复制粘贴可以一次性执行完,我已经测试过,没有问题! MySql存储过程简单实例:                                          ...

  2. MySql 存储过程实例(附完整注释)(转)

    MySql 存储过程实例(附完整注释) 将下面的语句复制粘贴可以一次性执行完,我已经测试过,没有问题! MySql存储过程简单实例:                                   ...

  3. PHP调用MYSQL存储过程实例

    PHP调用MYSQL存储过程实例 标签: mysql存储phpsqlquerycmd 2010-09-26 11:10 11552人阅读 评论(3) 收藏 举报 实例一:无参的存储过程$conn = ...

  4. 调用MYSQL存储过程实例

    PHP调用MYSQL存储过程实例 http://blog.csdn.net/ewing333/article/details/5906887 http://www.cnblogs.com/kkchen ...

  5. MySql 存储过程实例(附完整注释)

    将下面的语句复制粘贴可以一次性执行完,我已经测试过,没有问题! MySql存储过程简单实例:                                                       ...

  6. MySQL 存储过程实例 与 ibatis/mybatis/hibernate/jdbc 如何调用存储过程

    虽然MySQL的存储过程,一般情况下,是不会使用到的,但是在一些特殊场景中,还是有需求的.最近遇到一个sql server向mysql迁移的项目,有一些sql server的存储过程需要向mysql迁 ...

  7. mysql 存储过程实例

    --存储过程名和参数,参数中in表示传入参数,out标示传出参数,inout表示传入传出参数 create procedure p_procedurecode(in sumdate varchar(1 ...

  8. MySQL存储过程实例

    一.创建MySQL数据库函数 TCC:无参数,查询fruit表中的所有数据 : TAA:两个参数,查询fruit总共有多少行:查询ids为某个值时水果表的数据 TDD:两个参数,查询ids不等于某个值 ...

  9. Mysql 存储过程实例详解

    存储过程和函数是事先经过编译并存储在数据库中的一段SQL语句的集合,存储和和函数的区别在于函数必须有返回值,而存储过程没有,存储过程的参数可以使用IN.OUT.INOUT类型,而函数的参数只能是IN类 ...

随机推荐

  1. Codeforces 980E The Number Games 贪心 倍增表

    原文链接https://www.cnblogs.com/zhouzhendong/p/9074226.html 题目传送门 - Codeforces 980E 题意 $\rm Codeforces$ ...

  2. BZOJ3393 [Usaco2009 Jan]Laserphones 激光通讯 BFS

    原文链接http://www.cnblogs.com/zhouzhendong/p/8371735.html 题目传送门 - BZOJ3393 题意概括 直接看原题的翻译吧,很容易懂的. 题解 我不知 ...

  3. IDEA创建SpringBoot项目

    创建SpringBoot有三种方式: 方式一:(常用方式)

  4. pyqt pyside QAction 代码中触发

    pyqt pyside QAction 代码中触发 一般如果多个QAction(在同一个 QButtonGroup 中,而且是 checkable 的),不同情况下我们希望其中某个默认checked: ...

  5. Java常用API及Math类

    一.API的概述 API——Application Programing Interface:应用程序编程接口,是java提供的一些预定义的函数: 目的:基于API实现程序的快速编写,只需了解其作用, ...

  6. 如何让自己的Dev C++用上C++11,c++14标准

      首先确保Dev C++版本是最新的5.11版 其实用C++11和C++14标准的语法去运行还是会出现结果的,最多warning一下 但完美主义者是不允许这样的 我们可以点击菜单栏的“工具”-> ...

  7. 8. Rotate String

    8. Rotate String Description Given a string and an offset, rotate string by offset. (rotate from lef ...

  8. jsoup 解析html

    http://www.cnblogs.com/jycboy/p/jsoupdoc.html http://www.cnblogs.com/mokafamily/p/3558620.html

  9. AE视频制作 参考 资源 科幻科技风格 开场 公司企业宣传

    == 人类已经堕落,机器军团大举入侵,开始抹除人类,净化地球!-原创-高清正版视频在线观看–爱奇艺 这个视频片头不错.展示效果和音乐. == 外星人入侵地球,只为收集人类大脑!速看科幻电影<天际 ...

  10. CODEVS 1074 食物链 2001年NOI全国竞赛(洛谷 P2024)

    题目描述 Description 动物王国中有三类动物 A,B,C,这三类动物的食物链构成了有趣的环形.A吃B,B吃C,C吃A. 现有N个动物,以1-N编号.每个动物都是A,B,C中的一种,但是我们并 ...