Solved

Bulk insert into global temporary table

Posted on 2016-10-04
2
114 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 250 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 250 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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
oracle forms question 22 61
Help with Oracle IF statment 5 50
Excess Redo 3 49
Select the 2 most recent visit dates 5 31
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

738 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