自从那天灵感突现,搜了下MySQL存储过程的实现,我就再也不会为造测试数据这种事情烦恼了,存储过程用起来简直太方便了。
DROP PROCEDURE IF EXISTS insert2pay; DELIMITER $ create procedure insert2pay() begin declare i int default 1501; while i <= 6000 do insert into anypay.pay (merchant_id, merchant_no, merchant_channel_id, merchant_name, order_no, outer_no, tracking_number) values (1, '123', 1, 'lktz', concat('odn190611', i), concat('otn190611', i), '1231231235'); set i = i + 1; end while; end $ call insert2pay();