-- 创建存储过程
delimiter //
create procedure kmind(in num int ,in type int,in dateString VARCHAR(50))
begin
declare i int; # declare语句是在复合语句中声明变量的指令
set i=1;
while i<=num do
INSERT INTO
dit_mt_oauth2.oauth_track_log (id, type, source, create_time, update_time, deleted, client_id, user_name)
VALUES (
UUID(),
1,
'Middletier',
dateString,
dateString,
0,
'newtest',
'[email protected]'
);
set i=i+1;
end while;
end
//
delimiter ;
-- 调用存储过程
call kmind(1122,'2020-01-01 00:00:00');
-- 删除存储过程
drop procedure kmind
使用mysql存储过程批量插入数据
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.