Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Update SQL differences
Carlos,
update tablename t
set t.columname = (select t1.columname
from othertable t1 where t.id = t1.id)
will work fine and optimized ... if
you have an index on t1.columname.
Regards
Dante
In article <7gv72m$ih9$1_at_nnrp1.deja.com>,
cpereyra_at_ix.netcom.com wrote:
>
>
> In Sybase, the following command will succeed.
>
> update tablename
> set t.columname = t1.columname
> from tablename t, othertable t1
> where t.id = t1.id
>
> In Oracle it fails with a syntax error. I know that
> I can write a correlated subquery and get the same
> results, but I wonder if there is a different way.
> If the correlated subquery is the only way in Oracle,
> is the subquery flattened into a join by the optimizer?
>
> Thanks,
>
> Carlos Pereyra
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Fri May 07 1999 - 12:27:25 CDT
![]() |
![]() |