3 Replies Latest reply on Sep 14, 2018 10:16 AM by Pavel_p

    Packaged App where PL/SQL loop is used.

    Apex Learner

      Could you please tell me a packeaged app where pl/SQL loop like

      BEGIN

         FOR i IN 1 .. APEX_APPLICATION.g_f01.COUNT

         LOOP

            INSERT INTO emp_test (empno, status)

         VALUES (APEX_APPLICATION.g_f01 (i), APEX_APPLICATION.g_f02 (i));

         END LOOP;

         COMMIT;

      END;

       

      or share any work space with credentials where such example exists.

        • 1. Re: Packaged App where PL/SQL loop is used.
          Pavel_p

          Hi,

          please, take a look at Sample Database Application, Page 12, Populate Collections page process. If this is not what you are looking for, explain your requirements in more detail.

          As an aside, do not explicitly commit, APEX commits itself the entire transaction at the end in case of no exceptions, otherwise performs rollback. Issuing commit in the middle of the transaction can lead to data inconsistencies.

          Regards,

          Pavel

          1 person found this helpful
          • 2. Re: Packaged App where PL/SQL loop is used.
            Apex Learner

            Dear Sir Pavel_p; really thanks for your reply.

            Please review my this not answered thread for my requirement details.

            Looping throug row selector in oracle apex.

            • 3. Re: Packaged App where PL/SQL loop is used.
              Pavel_p

              Hi,

              maybe I'm wrong, but it seems that you're getting right the entire thing with APEX_APPLICATION.G_FXX arrays. These arrays correspond with report items rendered using APEX_ITEM https://docs.oracle.com/database/apex-18.1/AEAPI/APEX_ITEM.htm#AEAPI192 API function. Let's say we have a report (no matter if Classic or Interactive) based on

              select apex_item.checkbox2(p_idx => 1, p_value => e.empno) chk, --column must have Escape Special 
                    e.empno,
                    e.ename,
                    e.job,
                    e.mgr,
                    e.hiredate,
                    e.sal,
                    e.comm,
                    e.deptno
                from emp e
              

              then after the page submission (only) checked records from the chk column will be stored in APEX_APPLICATION.G_F01 array (the 01 corresponds with the p_idx value). If there were 2 (or more) columns rendered with APEX_ITEM with p_idx => 2 ..n, then their values would be stored in G_F02 .. G_F0N (up to 50) arrays.

              Please, login to my workspace on https://apex.oracle.com/pls/apex/htmldb

              workspace: pp_test

              user: test

              pwd: test

              Application 79475 - apex_gf_arrays_showcase

              To see a showcase how to use APEX_ITEM and G_F0X arrays.

              Regards,

              Pavel

              1 person found this helpful