首页 > 数据库 >MySQL存储过程之简单批量招数据

MySQL存储过程之简单批量招数据

时间:2022-12-23 17:25:35浏览次数:37  
标签:存储 batchInsert 批量 int MySQL test procedure

1.创建一个test_batchInsert的存储过程
delimiter $$$
create procedure test_batchInsert(in j int)
begin
declare i int default 0;
set i=0;
start transaction;
while i<j do
INSERT INTO table_name (id,name,create_time) VALUES (REPLACE(uuid(),"-",""),CONCAT("名字",i),current_timestamp())
set i=i+1;
end while;
commit;
end
$$$
delimiter;
2.运行存储过程

call test_batchInsert(20);

3.存在那些存储过程

drop procedure test_batchInsert

标签:存储,batchInsert,批量,int,MySQL,test,procedure
From: https://www.cnblogs.com/suzhitester/p/17001096.html

相关文章