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;
写一个存储过程,造一点测试数据
最新推荐文章于 2024-01-08 15:46:13 发布