24 Oct 2013

Bulk Collect

PROCEDURE process_all_rows
IS
   CURSOR table_with_227_rows_cur
   IS
      SELECT * FROM table_with_227_rows;

   TYPE table_with_227_rows_aat IS
      TABLE OF table_with_227_rows_cur%ROWTYPE
      INDEX BY PLS_INTEGER;

   l_table_with_227_rows table_with_227_rows_aat;
BEGIN  
   OPEN table_with_227_rows_cur;
   LOOP
      FETCH table_with_227_rows_cur
         BULK COLLECT INTO l_table_with_227_rows LIMIT 100;

         EXIT WHEN table_with_227_rows_cur%NOTFOUND;     /* cause of missing rows */

      FOR indx IN 1 .. l_table_with_227_rows.COUNT
      LOOP
         analyze_compensation (l_table_with_227_rows(indx));
      END LOOP;
   END LOOP;

   CLOSE table_with_227_rows_cur;
END process_all_rows;

No comments:

Post a Comment