Solved

Insert table rows from SQL query

Posted on 2007-11-14
4
2,368 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
[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
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

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

From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
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.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

726 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