Solved

Bulk insert into global temporary table

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Suggested Courses

635 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