如何修复“单个子查询返回多行”

时间:2019-08-21 15:33:29

标签: oracle-apex

我在oracle apex中执行此查询时遇到问题。请帮我解决问题。该查询将使用循环更新表中的多行。  开始

UPDATE app
SET APPFLG = 'A',
APRVBY=:app_user
WHERE ACTNUM = APEX_APPLICATION.G_f03 (v_row) and APPFLG = 'N';

IF SQL%NOTFOUND
THEN
    raise_application_error (
        -20001,
        'Unable to Update Customer :' || APEX_APPLICATION.G_f03 (v_row));
    ROLLBACK;
    RETURN;
ELSE
    UPDATE aas
    SET opndat = (select opndat from app where actnum = APEX_APPLICATION.G_f03 (v_row)),
        SANAD1 = (select SANAD1N from app where actnum = APEX_APPLICATION.G_f03 (v_row)),
        CRIRTE = (select CRIRTEN from app where actnum = APEX_APPLICATION.G_f03 (v_row)),
        DNPAMT = (select DNPAMTN from app where actnum = APEX_APPLICATION.G_f03 (v_row)),

    WHERE BRANCD = :AI_BRANCH_CODE AND actype = 'C88' and actnum = APEX_APPLICATION.G_f03 (v_row);

    for i in (select ACTNUM, CERTNO, CURVAL, SECSTS from sd_app where actnum= APEX_APPLICATION.G_f03 (v_row))
    loop
        update sd
        set ACTNUM =  i.ACTNUM,
            CERTNO = i.CERTNO, 
            CURVAL = i.CURVAL, 
            SECSTS =  i.SECSTS 
        where BRANCD = :AI_BRANCH_CODE AND actype = 'C88' and actnum = APEX_APPLICATION.G_f03 (v_row);                    
    end loop ;              
END IF;

实际结果可以更新sd表。

0 个答案:

没有答案