日期:2014-05-17  浏览次数:20767 次

oracle里的update问题
UPDATE   t2     SET   t2.USERNAME=t1.USERNAME,t2.ADDR=t1.ADDR   from   TEST001   t1,TEST002   t2   where   t1.USERID=t2.USERID
在SQL-Server下可以运行,在Oracle里不能运行,请问各位在Oracle里应该怎么写呢?

------解决方案--------------------
UPDATE TEST002 a SET (USERNAME,ADDR)=(Select USERNAME,ADDR
from TEST001 where USERID=a.USERID)
------解决方案--------------------
UPDATE TEST002 a SET (USERNAME,ADDR)=(Select USERNAME,ADDR
from TEST001 b where b.USERID=a.USERID)
where exists
(
select 1
from TEST001 b where b.USERID=a.USERID
)