Oracle’s Three Ways of Batch Insertion of Data [Recommendation]

Time:2019-5-14

The first is:


begin
  insert into tableName(column1, column2, column3...) values(value1,value2,value3...);
  insert into tableName(column1, column2, column3...) values(value1,value2,value3...);
  insert into tableName(column1, column2, column3...) values(value1,value2,value3...);
  ...
end;

Second species:


insert into tableName(column1, column2, column3...) values(value1,value2,value3...);
insert into tableName(column1, column2, column3...) values(value1,value2,value3...);
insert into tableName(column1, column2, column3...) values(value1,value2,value3...);

The third (using intermediate tables):

Insert into tableName (column1 (primary key), column2, column3...)
  select tableNames_seq.nextval,,column2,column3... from (
  select value1 column2,value2 column3,value3 column4 from dual
  union
  select value1 column2,value2 column3,value3 column4 from dual
  union
  select value1 column2,value2 column3,value3 column4 from dual
  union
  select value1 column2,value2 column3,value3 column4 from dual
)

summary

Above mentioned are three ways of Oracle batch insertion data introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support to developpaer.