update tb1 a set a.field1=(select a.field1||b.field2 from tb2 b where a.id=b.id)
where exists(select 1 from tb2 b where a.id=b.id);

解决方案 »

  1.   

    where exists(select 1 from tb2 b where a.id=b.id);这句是干啥的?
      

  2.   

    Oracle中的语法和Sql Server中的语法有些不一样,
    你那是中的写法
    但是在Oracle应该这样
    update 表1 a set a.字段1=(select a.字段1||b.字段2 from 表2 b where a.id=b.id)
      

  3.   

    如果a中的id,不在b中的时候,一定要加这句。否则会将a.field1错误的置为空
      

  4.   

    oracle中的UPDATE语法是没有from的
      

  5.   

    看見 ORARichard(没钱的日子......) 就知道問題已經解決了
    呵呵
      

  6.   

    update tb1 a set a.field1=a.field1||b.field2where exists(select 1 from tb2 b where a.id=b.id);
      

  7.   

    update tb1 a set a.field1=a.field1||b.field2where exists(select 1 from tb2 b where a.id=b.id);