Could do something like this, edit to match your tables/columns of course:

merge into tablea a
using tableb b
on (a.myvalue = b.myvalue)
when matched then update
set a.othervalue = b.othervalue

Or if not on 10G and on 9i:

merge into tablea a
using (
  select distinct b.myvalue, b.othervalue
  from tablea a, tableb b
  where a.myvalue = b.myvalue) bm
on (a.myvalue = bm.myvalue)
when matched then update
set a.othervalue = bm.othervalue
when not matched then insert (myvalue) values (null)




On Mon, 17 Jan 2005 16:42:23 -0500, Frank Mamone <[EMAIL PROTECTED]> wrote:
> I am having trouble doing an update with a join in Oracle.  I am
> getting this error:
> 
> SQL command not properly ended.
> 
> Here is the generic syntax I am using:
> 
> UPDATE TABLE1
> SET TABLE1.FIELD = TABLE2.FIELD
> FROM TABLE1, TABLE2
> WHERE TABLE1.KEY = TABLE2.KEY
> AND TABLE1.FIELD = 'Y'
> 
> Thanks for your help.
> 
> Frank
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190848
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to