Solved

Bulk insert into global temporary table

Posted on 2016-10-04
2
40 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
2 Comments
 
LVL 73

Accepted Solution

by:
sdstuber earned 250 total points
Comment Utility
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 34

Assisted Solution

by:Mark Geerlings
Mark Geerlings earned 250 total points
Comment Utility
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
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.

744 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now