Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Help inserting values into table using a subquery
On 6 Feb 2003 14:58:58 -0800, d_newsham_at_hotmail.com (D Newsham) wrote:
>Hi,
>
>I need to match up a column in two of my tables. Running the
>following query:
>
>select id from table1
>where id not in (select id from table2))
>
>returns 44 rows. I need to have table2 contain the exact same number
>of rows and id numbers as table1. I tried running this insert
>statement:
>
>insert into table2(id) values(select id from table1
>where id not in (select id from table2))
>
>but get the error:
>****************************************************
>insert into table2(id) values(select id from table1
> *
>ERROR at line 1:
>ORA-00936: missing expression
>****************************************************
>
>Is it possible to use a subquery to insert several values?
>
>Thanks
>D.
Yes, it is, and you are recommended to look up the proper syntax before posting, as this is a mere syntax question.
The syntax is
insert into ...
select
from
So you shouldn't use the values clause in this case.
Sybrand Bakker, Senior Oracle DBA
To reply remove -verwijderdit from my e-mail address Received on Thu Feb 06 2003 - 17:13:05 CST
![]() |
![]() |