update nanjing.nanjing_temp_table  a
   set (a.company_name, a.company_address)=(select b.company_name, b.company_address from nanjing.nanjing_temp_table  b
                                            where a.phone_number=b.phone_number and b.company_name is not null)
   where exists(select 1 from from nanjing.nanjing_temp_table  b
                where a.phone_number=b.phone_number and b.company_name is not null)
  and a.company_name is null

解决方案 »

  1.   

    ks_reny大哥 显示表名称错误怎么回事啊?update nanjing.nanjing_temp_table a
    set (a.company_name, a.company_address)=(select b.company_name, b.company_address from nanjing.nanjing_temp_table  b
    where a.phone_number=b.phone_number and b.company_name is not null)
    where exists(select 1 from from nanjing.nanjing_temp_table  b
    where a.phone_number=b.phone_number and b.company_name is not null)
    and a.company_name is null
    Error at line 1
    ORA-00903: invalid table name
      

  2.   

    select 1 from from nanjing.nanjing_temp_table 这里多了个from阿。晕运行是运行了
    可还有多集的问题
    update nanjing.nanjing_temp_table a
    set (a.company_name, a.company_address)=(select b.company_name, b.company_address from nanjing.nanjing_temp_table  b
    where a.phone_number=b.phone_number and b.company_name is not null)
    where exists(select 1 from nanjing.nanjing_temp_table  b
    where a.phone_number=b.phone_number and b.company_name is not null)
    and a.company_name is null
    Error at line 2
    ORA-01427: single-row subquery returns more than one row