-- 創建存儲過程
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存儲過程批量插入數據
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.