title: How to fix "single sub-query returns multiple rows"
body: <p>I have a problem to execute this query in oracle apex. Please help me how to fix it. The query will update multiple rows in the table using loop.
   begin</p>
  
  <pre><code>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;
  </code></pre>
  
  <p>The actual result can update the sd table.</p>