It was another time when I got off work, and my work was tense and orderly. An error occurred while exporting more than 2000 pieces of data. The export format is one sheet per 20 pieces of data.
How can we simulate so much data for verification? The company environment does not have that much data and many business tables are associated. It is unrealistic to manually add data, if we use the automation tool qtp to implement it, we need to write a long automatic script to implement it, and it will take a long time to run the script. In addition, we are about to get off work soon. The time is too short to waste a little time, it must be implemented in an efficient way. At this time, we thought of inserting data in the background and generating data using a stored procedure loop, which greatly saves time.
The script for calling the stored procedure is as follows:
Declare out_return_code varchar2 (1000); out_return_msg varchar2 (1000); out_code number; out_msg varchar2 (1000); I int; begin -- call the procedure for I in 1 .. 2001 loop ecms. pkg_billing_shandongcharge.p_insert_elec ('20170101', 'rouak4701 ', '20170101', '1', to_date ('2017-3-7 7:00:00', 'yyyy-MM-DD hh24: MI: SS ') + 0.001 * I, to_date ('2017-3-7 7:10:00', 'yyyy-MM-DD hh24: MI: ss') + 2013 * I, 'yyy ', 'yyy', '01', I + 1, out_return_code, out_return_msg, out_code, out_msg); End loop; commit; end;
Because the business has a verification of the time and mileage and needs to be greater than the previous time, the data is '+' during the cycle to meet business requirements.
For more than 2000 pieces of data, it takes several seconds to execute the script. The data is good and it is very convenient to verify the on-site conditions.
Appendix: verification of generated data:
Select R. *, rownum row_no from (select T. manual_measure_id colldataid, to_char (T. atomicity, '2017. 999 ') chargecapacity, T. cust_no custno, (select O. org_name from o_org O where T. sp_org_no = O. org_no) energy_org_no, T. license_no licenseno, T. ratable_event_id, to_char (T. start_time, 'yyyy-mm-dd hh24: MI: ss') starttime, to_char (T. end_time, 'yyyy-mm-dd hh24: MI: ss') endtime, T. stake_no, (select O. org_name from o_org O where T. org_no = O. org_no) custorgno, T. driver driver, T. station_staff, decode (T. measure_type, '01', 'recharged ', '02', 'power-change') measure_type, T. mileage_consume travelmileage, T. checkout_flag measure_mark, decode (T. checkout_flag, '01', 'unbilled ', '02', 'billable') checkout_flag from e_manual_measure t where T. license_no = 'rouak4701 'order by T. start_time DESC, T. end_time DESC) r