Oracle batch operation the following code is used for exercises when learning oracle. batch operation can solve the efficiency problem well: www.2cto.com Java code --- create table test2 (id number (6 ), name varchar2 (10) delete test2; select * from test2; ------ batch insert declare type id_table is table of number (6) index by binary_integer; type name_table is table of varchar2 (10) index by binary_integer; v_ids id_table; v_names name_table; starttime number (10); endtime number (10); begin starttime: = dbms_utility.get_time; for I in 1 .. 100000 loop v_ids (I): = I; v_names (I): = to_char (I) | 'hes'; end loop; /*************************************** * ********************************** it is not loop, instead, insert many records into the database forall I in 1 at a time .. the syntax of v_ids.count starts with forall index in .. end *************************************** * *********************************/forall I in 1.. v_ids.count insert into test2 (id, name) values (v_ids (I), v_names (I); endtime: = dbms_utility.get_time; dbms_output.put_line (endtime-starttime); end; ------ the batch result is 18 --- insert declare starttime number (10); endtime number (10); begin starttime: = dbms_utility.get_time; for I in 1 .. 100000 loop insert into test2 (id, name) values (I, to_char (I) | 'he '); end loop; endtime: = dbms_utility.get_time; dbms_output.put_line (endtime-starttime ); end; ---- the length of time is 262. In terms of time, the efficiency difference is at least 10 times www.2cto.com ---- another bulk collect operation) declare type test_table is table of test2 % rowtype index by binary_integer; v_testtable test_table; begin /************************************** ******************************. bulk collect Syntax :.......... bulk collect into collectName ************************************ * *****************************/select * bulk collect into v_testtable from test2; dbms_output.put_line (v_testtable.count); end;