title: Should FORALL place outside of for loop?
body: <p>I'm new to PL/SQL.<br>
  I decided to use the following SQL to insert thousands of record to a table. However, is it correct to place the FORALL statement outside for loop?<br>
  Is it better to move the FORALL statement inside for loop block? Thank you.</p>
  
  <pre><code>DECLARE
  
     CURSOR books_cur
     IS
      SELECT book_id, book_type
      FROM books
      WHERE book_category = 'PROGRAMMING';
  
     TYPE book_ids_t IS TABLE OF 
      books.book_id%TYPE;
  
     l_book_ids   book_ids_t := book_ids_t();
  
  BEGIN
     FOR i IN books_cur LOOP
      IF(i.book_type = 'PLSQL') THEN
          l_book_ids.EXTENDS;
          l_book_ids(l_book_ids.LAST) := i.book_id;
      END IF;
     END LOOP;
  
     FORALL i IN l_book_ids.FIRST..l_book_ids.LAST
      INSERT INTO table_a (book_id) VALUES l_book_ids(i);
  END;
  </code></pre>