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
d_newsham_at_hotmail.com said...
> 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.
>
Dump the 'values(...)' when selecting for insert.
insert into table2(id) select...
-- /KarstenReceived on Thu Feb 06 2003 - 18:38:03 CST
![]() |
![]() |