您的位置:首页 > 其它

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

2016-07-28 17:14 211 查看
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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: