Use stored procedures to add data instances in batches

@Use stored procedures to add data instances in batches

delimiter $$ – //mark with delimiter and use $ to indicate the end of the stored procedure
create procedure pre() – //create pre() storage method
begin
declare i int; – /define i variable
set i=6001;
while i<6021 do - // configuration value i
- // data into the database statement
the iNSERT the INTO leaseback. apply_payment_order( id, pay_id, vendor_id, vendor_name,

open_bank, bank_card, total_money, total_amount, remark, apply_name, acquire_pay_time,

insert_by, insert_at, update_by, update_at, audit_state, pay_state, pay_proof, dept_name,
area, pay_channel) VALUES (i, CONCAT ( 'FK20190815', i), 'GYS00001', 'FAW-Volkswagen XYZ Limited',
'China Jinjiang certain branch', '000000724124', '1000.89 ', '1','I am adding data',
'zzb00185', '2019-08-16 00:00:00','zzb00185', '2019-08-15 17:31:03', NULL, NULL,'Not submitted','','',
'Risk and Asset Management Center','Dongcheng District','Cash/Transfer Check');
set i=i+1; – //Auto-increment loop
end while;
end
$$-// end of stored procedure

Call the stored procedure
call pre();

View the existing stored procedure
show procedure status;
view the table creation statement of the stored procedure
show create procedure pre;
delete the stored procedure method
drop procedure if exists pre;

Guess you like

Origin blog.csdn.net/Krystal_RonghuiLi/article/details/107998668