4 Replies Latest reply: Jan 23, 2013 4:12 AM by Ahmed Alsaied RSS

    Issue in update process

    Ahmed Alsaied
      Dears ,

      i have master and manual tabular detail , i am use this code to update in manula tabular
      DECLARE
         vrow   BINARY_INTEGER;
      BEGIN
       FOR i IN 1 .. apex_application.g_f31.COUNT                         
         LOOP
            IF     apex_application.g_f31 (i) IS NOT NULL      THEN
      
           UPDATE STORAGE_GARD_DET
      SET ITEM_QNTY = apex_application.g_f33(i)
      WHERE GARD_DET_NO =apex_application.g_f31(i);
      END IF;
       END LOOP;
      END;
      but it's no update after press in apply change
        • 1. Re: Issue in update process
          Mahmoud_Rabie
          Dear Abo Yahya,

          I assume that you are using tabular form.
          You missed the COMMIT and I would write the code as following:
          BEGIN
            for i in 1..apex_application.g_f01.count loop    
                If  apex_application.g_f31(apex_application.g_f01(i)) IS NOT NULL THEN
                   UPDATE STORAGE_GARD_DET
                   SET ITEM_QNTY = apex_application.g_f33(apex_application.g_f01(i))
                   WHERE GARD_DET_NO =apex_application.g_f31(apex_application.g_f01(i));
                END IF;
            END LOOP;
            COMMIT;
          END;
          Please, if this answers your question, mark it as Correct otherwise as helpful

          Best Regards
          Mahmoud
          • 2. Re: Issue in update process
            dominiquefortin
            :Mahmoud_Rabie
            You missed the COMMIT and I would write the code as following:
            There is no need for commit statement. APEX commits automatically.



            :Abo Yahya

            To see what happens, I would add the following statement and look in the debug window (or in the inline debug information for version < 4.0) for the value of "g_f31.COUNT".
            DECLARE
               vrow   BINARY_INTEGER;
            BEGIN
             wwv_flow.debug('apex_application.g_f31.COUNT="'||apex_application.g_f31.COUNT||'"');
             FOR i IN 1 .. apex_application.g_f31.COUNT                         
               LOOP
            ...
            • 3. Re: Issue in update process
              Ahmed Alsaied
              Dears ,
              thanks for all ..... i am try to use this code and it working well
              DECLARE
                  v_updatecount   NUMBER := 0;
              BEGIN
                 FOR i IN 1 .. apex_application.g_f31.COUNT                         
                 LOOP
                    IF     apex_application.g_f31 (i) IS NOT NULL      THEN
               
                       UPDATE STORAGE_GARD_DET
                          SET  ITEM_QNTY =apex_application.g_f33 (i)            
                        WHERE GARD_DET_NO = apex_application.g_f31 (i);
              
                       v_updatecount := v_updatecount + 1;
                             
                    END IF;
                 END LOOP;
                 :P119_UPDATE_COUNT := v_updatecount;
              END;
              Thanks
              Abo Yahya