写一个存储过程,造一点测试数据

3 篇文章 0 订阅

drop procedure if exists copy_task_proc;

/* 
 * 存储过程,将指定SQ执行totalCount次 
 */
create procedure copy_task_proc(IN totalCount int)
begin

	declare i int;
	set i=0;
	while i<totalCount do
		-- 要执行的SQL语句
		-- 复制当前表的数据,插入到当前表
		insert into task_ta_tbl select uuid(), -- GUID函数
				t.handle_type,t.match_sign,t.sender,t.t_receiver,t.faxNumber,t.flow_imp_id,t.status_id,t.read_tag,t.prev_hander,t.curr_hander,t.next_hander,t.sequence_no,t.subject,t.comments,t.priority,
				now(), -- 当前时间函数
				t.t_send_time,t.last_update_time,t.file_name,t.sign_flag,t.print_flag,t.e_mail,t.send_mark,t.traders,t.contract_time,t.lister,t.instruct_date from task_ta_tbl as t;
		set i=i+1;
	end while;

end;

-- 调用存储过程
call copy_task_proc(1);

-- 统计数据
-- select count(*) from task_ta_tbl;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值