Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: update
HI,
what about
update table2 set ref_ID = ( select ID_let||ID_num from table1 ) ;
Please keep in mind that this will due to the lack of any where clause for
the update ALL ROWS in table2.
Furthermore it will still complain that ' a single row subquery returns
more the one row' because there won't be only one row in table1
So I guess what you are intending is something like a correlated update :
update table2 t2 set ref_ID = ( select ID_let||ID_NUM from table1 t1 where t1.any_column = t2.any_column )
But take care as this will set ref_ID to NULL if it doesn't find anything
in the subquery. And as there doesn't exists any where clause for table2
this
will evaluate the subquery statement for EvERY row in table2
Please give some more information of what should achieved by this update.
chris_at_ultramedia.co.uk wrote:
> How can I get the following to work?
>
> update table2
> set ref_ID =
> select ID_let||ID_num from table1;
>
> ..it complains of where the select statement begins
>
> TIA
>
> Chris - chris_at_ultramedia.co.uk
> ------------------------------
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
Received on Thu Jun 18 1998 - 14:47:07 CDT
![]() |
![]() |