update dssd_impo_user a 
  set power_type_name=(select nvl(f.line_name,'NULL') 
                        from 
                         (select distinct(c.user_no),b.line_name line_name,b.line_code
                            from dbo.line_gyyd b,dbo.power_file_gyyd c
                            where c.line_code=b.line_code 
                              and c.user_no not like 'X%' )f 
                        where a.user_no=f.user_no)
  and a.dept_id=40;
commit;这样修改了后你在试试,这是因为f.line_name可能为空,所以要进行处理一下nvl(f.line_name,'NULL'),另外b.line_name在表f中可能没有明确指定,所以指定一个别名。

解决方案 »

  1.   

    为什么我看不懂呀。
    f.line_name是什么呀,是字段,类型,还是系统里什么东东呀?我顶,我顶,我顶顶!
      

  2.   

    报这个缺少表达式的错的原因是少了()吧
    update dssd_impo_user a
    set power_type_name=   (   select  f.line_name from 
    (select distinct(c.user_no) ,b.line_name,b.line_code
    from dbo.line_gyyd b,
    dbo.power_file_gyyd c
    where   c.line_code=b.line_code 
    and c.user_no not like 'X%' )f  where f.user_no=a.user_no   )   
    where  a.dept_id=40;
    commit;