开始,表yz.a中有2行数据,现在插入1万行。
13:54:02 yz> delimiter $
13:55:46 yz> SET AUTOCOMMIT = 0$$
Query OK, 0 rows affected (0.00 sec)
ERROR:
No query specified
13:55:51 yz> create procedure test()
-> begin
-> declare i decimal (10) default 0 ;
-> dd:loop
-> insert into a(id,name,sex) values(1,'yz','boy');
-> commit;
-> set i = i+1;
-> if i= 10000 then leave dd;
-> end if;
-> end loop dd ;
-> end;$
Query OK, 0 rows affected (0.01 sec)
13:57:48 yz> delimiter ;
13:57:53 yz> call test;
Query OK, 0 rows affected (14.83 sec)
13:58:15 yz> select count(1) from a;
+----------+
| count(1) |
+----------+
| 10002 |
+----------+
1 row in set (0.00 sec)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31447263/viewspace-2151523/,如需转载,请注明出处,否则将追究法律责任。