mysql存储过程--往表中批量插入数据
生活随笔
收集整理的這篇文章主要介紹了
mysql存储过程--往表中批量插入数据
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
為什么80%的碼農都做不了架構師?>>> ??
1、創建表:
create test_a( id int);
2、創建存儲過程
delimiter $$
?create procedure batch_insert()?begin
? ? DECLARE max int;
DECLARE rc int;
? ? set max =10000;
? ? set rc =1;
loopl: while rc<max do
? ? ? ? insert into test_a values(rc);
? ? ? ? set rc=rc+1;
end while loopl;
?end$$
?delimiter ;
3、調用存儲過程:
call batch_insert();
轉載于:https://my.oschina.net/binXu/blog/108773
總結
以上是生活随笔為你收集整理的mysql存储过程--往表中批量插入数据的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: oc中单例
- 下一篇: [转]我们为什么需要工作流