Quick Search:
 
 Oracle PL/SQL: FORALL Jump to:  
Category: >> Oracle PL/SQL >> FORALL  

<< lastnext >>

Snippet Name: FORALL

Description: FORALL transfers data from a PL/SQL collection to the specified table using collections. The following code example shows a procedure that accepts a nested table of book information and inserts the full contents of that collection (the binding array) into the book table. Note that this example also takes advantage of Oracle9i's FORALL enhancement that allows the INSERT of a record directly into a table.

Comment: (none)

Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 02nd, 2009

FORALL <index_name> IN <lower_boundary> .. <upper_boundary>
 
CREATE TYPE books_nt 
  IS TABLE OF book%ROWTYPE; 
/
CREATE OR REPLACE PROCEDURE add_books (
  books_in IN books_nt)
IS
BEGIN
  FORALL book_index 
    IN books_in.FIRST .. books_in.LAST
    INSERT INTO book 
       VALUES books_in(book_index);
   ...
END;
 
 


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org