Skip to Main Content
  • Questions
  • Best way to insert millions of records into a table in real time.

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Haider.

Asked: March 12, 2020 - 5:04 pm UTC

Last updated: March 13, 2020 - 4:36 pm UTC

Version: 11gr2

Viewed 1000+ times

You Asked

Hello Tom,

My requirement is as follows:

1. My front end application (in Oracle Forms) inserts a row into a table (table_1).
2. As soon as data is inserted into table_1, around 1 million records are expected to be inserted into another table (table_2).

As a solution, I am thinking of using an AFTER ROW TRIGGER on table_1 and then using using BULK COLLECT in order to INSERT data into table_2

This shall be a yearly activity.

Could you please let me know your thoughts on this solution.

Thank You

and Chris said...

I'm a bit baffled as to why you want to do this.

Instead of a trigger I'd code the insert into table_2 as part of the post-process action.

then using using BULK COLLECT in order to INSERT data into table_2

Personally I'd start with a single insert as select:

insert into table2
  select ... from ...


Without more details on what exactly you're doing it's pretty much impossible to give better advice.

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

SQL

The Oracle documentation contains a complete SQL reference.