Mega Code Archive

 
Categories / Oracle PLSQL / PL SQL
 

Bulk Collection

SQL> SQL> declare   2    x number;   3  begin   4    select object_id   5    into   x   6    from   all_objects   7    where  rownum <= 1;   8  end;   9  / PL/SQL procedure successfully completed. SQL> SQL> SQL> --Here is the equivalent bulk collection version to get 500 rows in a single call. SQL> SQL> declare   2    type numlist is table of number;   3    x numlist;   4  begin   5    select object_id   6    bulk collect into x   7    from   all_objects   8    where  rownum <= 500;   9  end;  10  / PL/SQL procedure successfully completed.