mysql+存储过程+参数赋值_mysql存储过程实例,查询多参数赋值

本文展示了如何在MySQL中创建并调用存储过程,包括参数赋值和循环更新、插入数据的实例。存储过程用于处理多条SQL语句,通过示例解释了如何在`schedu_create_info`和`crm_t_customer`表中操作数据。
摘要由CSDN通过智能技术生成

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_

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值