Solved

Insert table rows from SQL query

Posted on 2007-11-14
4
2,353 Views
Last Modified: 2013-12-19
How do I write Oracle SQL expression (using TOAD) that inserts rows into a table from a select statement, ie "Insert into table(field 1, field 2, field 3, etc) values(select field1, field2, field3 from tables where conditions)"?

Thank you.
0
Comment
Question by:pelican45
  • 2
4 Comments
 
LVL 3

Expert Comment

by:davisnw
ID: 20286046
insert into destinationTable (field1, field2, field3) SELECT field1,field2, field3 from sourcetable where ....
0
 
LVL 3

Accepted Solution

by:
davisnw earned 250 total points
ID: 20286064
(Basically, when you do an insert based on a select, you simply omit the VALUES key word)
0
 
LVL 28

Assisted Solution

by:Naveen Kumar
Naveen Kumar earned 250 total points
ID: 20297855
even we can do it like this ( in this case we should ensure that our select list has that many number of columns which are required for the destination table ). Ofcourse, the data types of the select list columns and data types
should match as well which is normal for any insert command.

insert into destinationTable SELECT field1,field2, field3 from sourcetable where ....

Thanks

0
 

Author Closing Comment

by:pelican45
ID: 31409274
Thank you both
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.

Question has a verified solution.

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

Suggested Solutions

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
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…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to recover a database from a user managed backup

770 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