Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Bulk insert into global temporary table

Posted on 2016-10-04
2
Medium Priority
?
217 Views
Last Modified: 2016-10-11
Hi ,


create a global temporary table mytable as follows in Oracle:

create global temporary table mytable (

   column definitions

) on commit preserve rows;

However, I also want to bulk insert hundreds of rows without writing a SQL insert statement hundreds of time.

select * from mysourcePool;  -- hundreds of rows to be used in bulk insert data

How do I combine both operations?
0
Comment
Question by:LuckyLucks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 1000 total points
ID: 41828382
insert into mytable (a,b,c,d)  select w,x,y,z from mysourcepool.


replace a,b,c,d,w,x,y,z  with your real columns, expand as needed
0
 
LVL 35

Assisted Solution

by:Mark Geerlings
Mark Geerlings earned 1000 total points
ID: 41828409
You don't need hundreds of "insert...select ...from..." statements to insert hundreds of rows to either a global temporary table or a standard Oracle table.

You simply add "where" clause conditions to the "select ... from..." part of the statement to include whatever rows should be included.   These will all be inserted in one step with no "bulk collect" needed.  This is faster and more efficient that using a PL\SQL procedure that includes a cursor and "bulk collect".
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to recover a database from a user managed backup

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question