select BULK COLLECT : bulk collect « PL SQL Statements « Oracle PL/SQL Tutorial

Oracle PL/SQL Tutorial
1. Introduction
2. Query Select
3. Set
4. Insert Update Delete
5. Sequences
6. Table
7. Table Joins
8. View
9. Index
10. SQL Data Types
11. Character String Functions
12. Aggregate Functions
13. Date Timestamp Functions
14. Numerical Math Functions
15. Conversion Functions
16. Analytical Functions
17. Miscellaneous Functions
18. Regular Expressions Functions
19. Statistical Functions
20. Linear Regression Functions
21. PL SQL Data Types
22. PL SQL Statements
23. PL SQL Operators
24. PL SQL Programming
25. Cursor
26. Collections
27. Function Procedure Packages
28. Trigger
29. SQL PLUS Session Environment
30. System Tables Data Dictionary
31. System Packages
32. Object Oriented
33. XML
34. Large Objects
35. Transaction
36. User Privilege
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Oracle PL/SQL Tutorial » PL SQL Statements » bulk collect 
22. 17. 1. select BULK COLLECT
SQL> create table cities
  2  as
  3  select username city
  4    from all_users
  5   where rownum<=37;

Table created.

SQL>
SQL> alter table cities
  2  add constraint
  3  cities_pk primary key(city);

Table altered.

SQL>
SQL> create table with_ri
  2  x    char(80),
  3    city references cities
  4  );

Table created.

SQL>
SQL> create table without_ri
  2  x    char(80),
  3    city varchar2(30)
  4  );

Table created.

SQL> alter session set sql_trace=true;

Session altered.

SQL>
SQL> declare
  2      type array is table of varchar2(30index by binary_integer;
  3      l_data array;
  4  begin
  5      select * BULK COLLECT into l_data from cities;
  6      for i in .. 1000
  7      loop
  8          for j in .. l_data.count
  9          loop
 10              insert into with_ri
 11              values ('x', l_data(j) );
 12              insert into without_ri
 13              values ('x', l_data(j) );
 14          end loop;
 15      end loop;
 16  end;
 17  /

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL> drop table cities cascade constraint;

Table dropped.

SQL> drop table with_ri;

Table dropped.

SQL> drop table without_ri;

Table dropped.

SQL>
SQL>
22. 17. bulk collect
22. 17. 1. select BULK COLLECT
22. 17. 2. Adding a limit to BULK COLLECT
22. 17. 3. To get the same result by using explicit cursors and bulk collect
22. 17. 4. Speeding Up Data Collection with Bulk Operations
22. 17. 5. Using the RETURNING ...BULK COLLECT clause to SELECT directly into a PL/SQL array
22. 17. 6. Demonstrate how to use DELETE with bulk processing.
22. 17. 7. Bulk processing with the FORALL statement
22. 17. 8. Bulk collect with non-cursor SELECT into multiple collections
22. 17. 9. Bulk collect from cursor with LIMIT option
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.