Insert table rows from SQL query

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.
pelican45Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
davisnwConnect With a Mentor Commented:
(Basically, when you do an insert based on a select, you simply omit the VALUES key word)
0
 
davisnwCommented:
insert into destinationTable (field1, field2, field3) SELECT field1,field2, field3 from sourcetable where ....
0
 
Naveen KumarConnect With a Mentor Production Manager / Application Support ManagerCommented:
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
 
pelican45Author Commented:
Thank you both
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.