本帖最后由 ulitxwhite 于 2010-08-20 13:09:44 编辑

解决方案 »

  1.   

    update hi_psndoc_deptchg a
    set a.lastflag = 'N'
    where 
    exists (select 1 from from hi_psndoc_deptchg a
    left join bd_psndoc b on a.pk_psnbasdoc = b.pk_psnbasdoc
    and  a.enddate is not null and b.psnclscope = '0' )
      

  2.   

    错了
    update hi_psndoc_deptchg a
    set a.lastflag = 'N'
    where  
    exists (select 1 from hi_psndoc_deptchg a
    left join bd_psndoc b on a.pk_psnbasdoc = b.pk_psnbasdoc
    where a.enddate is not null and b.psnclscope = '0' )
      

  3.   

    update hi_psndoc_deptchg a
    set a.lastflag = 'N'
    where a.enddate is not null and a.pk_psnbasdoc=
    (select pk_psnbasdoc from 
     bd_psndoc b where b.psnclscope = '0' )
      

  4.   

    这个思路很好,但是报错了:ORA-01427 单行子查询返回多个行
      

  5.   

    UPDATE HI_PSNDOC_DEPTCHG A
    SET A.LASTFLAG = 'n'
    WHERE
    EXISTS(
    SELECT 1 
    FROM  BD_PSNDOC B WHERE A.PK_PSNBASDOC = B.PK_PSNBASDOC
    AND A.ENDDATE IS NOT NULL AND B.PSNCLSCOPE = '0'
    );
    试试这个看看.我没有测试!