Sunteți pe pagina 1din 5

HOME ABOUT ME: SHAILENDER THALLAM CONTACT ORACLE APPS INTERVIEW QUESTIONS Search the archive...

Home » PL/SQL

WshB ia UtLKC OLLECT?H owa ndW hyd ow en eed


otu ?tsie
31 DECEMBER 2014 229 VIEWS 0 COMMENTS ARTICLE BY SHAILENDER THALLAM
Before understanding about BULK COLLECT, lets see how a PL/SQL code is executed. Oracle uses two
engines to process PL/SQL code. All procedural code is handled by the PL/SQL engine while all SQL is
handled by the SQL engine. When ever there is a need to process an SQL statement, a context switch
happens between PL/SQL and SQL engines.
Image a cursor with a SELECT statement which retrieves 1000 rows, in such scenario a context switch
will happen for 1000 times which consumes lot of CPU resources and leads to a performance issue.
BULK COLLECT is one of the way to solve this problem.
BULK COLLECT is one of the way of fetching bulk collection of data. With Oracle bulk collect, the
PL/SQL engine tells the SQL engine to collect many rows at once and place them into a collection.
During an Oracle bulk collect, the SQL engine retrieves all the rows and loads them into the collection
and switches back to the PL/SQL engine. When rows are retrieved using Oracle bulk collect, context
switch happens only once. The larger the number of rows you would like to collect with Oracle
bulk collect, the more performance improvement you will see using an Oracle bulk collect.
Example
In this example, lets use BULK COLLECT to fetch information of all the applications present in an EBS
instance.
Recent Posts
W hat is the role of a Functional Consultant in
Support and Implementation Project?
API approach to find On Hand Quantity of an
Item
W hat is the Difference betw een Available to
Reserve & Available to Transact
W hat is BULK COLLECT? How and W hy do w e
need to use it?
Frequently asked SQL Interview Questions
on EMP, DEPT table
Top PL/SQL Interview Questions w ith
Answ ers
W hy cant w e use SQLERRM and SQLCODE in
INSERT Statement?
FND_GLOBAL and FND_PROFILE: Import List
of System Global values
XML Publisher Interview Questions w ith
Answ ers
MD50, MD70 and MD120 Templates – Free
Dow nload
How to Schedule a concurrent program from
Backend
SQL Query to find Status of Inventory
Accounting Periods
Enter your email address Subbssccrriibbee
STAY CONNECTED
Subscribe FREE updates on your Email | RSS
My Sponsers~!
Recent Posts from this Category
W hat is the role of a Functional Consultant in
Support and Implementation Project?
API approach to find On Hand Quantity of an
Item
W hat is the Difference betw een Available to
Reserve & Available to Transact
W hat is BULK COLLECT? How and W hy do w e

D o y o u w a n t t o m e e t y o u r f e l l o wF aOc re ab co l oe k A p p s C o n s u Migration for Oracle EBS


Deliver Zero Error EBS migrations for the cost of your daily coffee
conve rte d by W e b2PDFC onve rt.com
123456789
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
DECLARE
TYPE xx_rec IS RECORD (
col1 fnd_application.APPLICATION_ID%TYPE,
col2 fnd_application.APPLICATION_SHORT_NAME%TYPE,
col3 fnd_application.PRODUCT_CODE%TYPE,
col4 fnd_application.BASEPATH%TYPE
); --Record Type
TYPE xx_tab IS TABLE OF xx_rec
INDEX BY BINARY_INTEGER; --Table Type
v_tab xx_tab; --This is a type of Collection
--
--Cursor to list all applications in EBS instance
--
CURSOR cur
IS
SELECT application_id, application_short_name, product_code, basepath
FROM fnd_application;
BEGIN
OPEN cur;
FETCH cur
BULK COLLECT INTO v_tab; --BULK COLLECT usage
CLOSE cur;
FOR l_index IN v_tab.FIRST .. v_tab.COUNT
LOOP
DBMS_OUTPUT.put_line ( v_tab (l_index).col1
|| ' '
|| v_tab (l_index).col2
|| ' '
|| v_tab (l_index).col3
|| ' '
|| v_tab (l_index).col4
);
END LOOP;
END;
Note: Remember that collections are held in memory, so doing a bulk collect from a large query could
occupy most of your memory considerably leading to performance problem. Instead you can limit the
rows returned using the LIMIT clause and move through the data processing smaller chunks. Below is
an example of usage of LIMIT clause
OPEN cur;
FETCH cur
BULK COLLECT INTO v_tab LIMIT 100; --limiting BULK COLLECT to 100 records each per a context switch
CLOSE cur;
For Further Reading
1. Top PL/SQL Interview Questions with Answers
2. Useful Information about Workflow Background Process Concurrent Program
3. Script to close workflow notifications from backend
4. SQL Tuning or SQL Optimization
need to use it?
Frequently asked SQL Interview Questions
on EMP, DEPT table
Top PL/SQL Interview Questions w ith
Answ ers
W hy cant w e use SQLERRM and SQLCODE in
INSERT Statement?
FND_GLOBAL and FND_PROFILE: Import List
of System Global values
XML Publisher Interview Questions w ith
Answ ers
MD50, MD70 and MD120 Templates - Free
Dow nload
Tag Cloud
back to back order
concurrent manager
C ost Manager
Diagnostics
dropshipment Errbuf

FNDLOAD
FNDLOAD download
FNDLOAD upload
FND_DEVELOPER_MODE
FND_DEVELOPER_MODE
in routine

fnd_request.submit_request
How to port reports
from one instance to
another HRMS Profile
Options iStore items
not available ldt files
Line Status Flow MOAC
Move Transaction
Manager O2C C ycle
Oracle Logo Pending
Resource Transactions
personalization pl/sql
procedures porting
reports profileoption
Profile options Reports
Retcode Sales Order
line Status Flow Ship
C onfirm button greyed
Shipping Transactions
form table suffix
WIP_C OST_TXN_INTERFAC E
_A _AC N _ALL _AVN
_B _F _S _TL _V _VL
COPYRIGHT
This w ork is licensed
under a Creative
Commons-
NonCommercial 2.5
License.
Categories
Alerts (1)
AOL and SYSADMIN
(29)
AOL SQL Scripts
(20)
APIs (3)
Business Events
(2)
Custom PLL (1)
HRMS (4)
Interview
Questions (5)
Inventory (7)
iRecruitment (1)
iStore (1)
OAF (4)
Oracle Apps Basics
(16)
Oracle Learning
Management (4)
Oracle SQL (13)
Order Management
(11)
Personalizations
(4)
PL/SQL (10)
Profile Options (5)
Purchasing (3)
Receivables (1)
Reports (2)
Security (1)
Shipping Execution
(2)
Unix / Shell Scripts
(1)
W IP Jobs (1)
W orkflow s (12)
XMLP (9)
conve rte d by W e b2PDFC onve rt.com
Oracle Apps DNA . Com
170 people like Oracle Apps DNA . Com.
Facebook social plugin
LLiikkee
WOW! Did you like this post? We'll send more interesting posts like What is BULK COLLECT? How
and Why do we need to use it? to you!
Enter your Email Address:
Enter your email address Subscribe Me!
0 Comments OracleAppsDNA  Login
Sort by Oldest Share ⤤
Start the discussion…
✉ Subscribe d Add Disqus to your site  Privacy
Favorite ★
Recent Posts
W hat is the role of a Functional Consultant
in Support and Implementation Project?
API approach to find On Hand Quantity of
an Item
W hat is the Difference betw een Available
to Reserve & Available to Transact
W hat is BULK COLLECT? How and W hy do
w e need to use it?
Frequently asked SQL Interview Questions
on EMP, DEPT table
Top PL/SQL Interview Questions w ith
Answ ers
W hy cant w e use SQLERRM and SQLCODE
in INSERT Statement?
FND_GLOBAL and FND_PROFILE: Import
List of System Global values
XML Publisher Interview Questions w ith
Answ ers
MD50, MD70 and MD120 Templates – Free
Dow nload
Most Viewed
[Decrypting User Passw ord]How to find
passw ord of a User in Oracle Apps R12? -
12,349 view s
Top PL/SQL Interview Questions w ith
Answ ers - 8,638 view s
SQL Query to list Active Responsibilities of
a Active User - 8,596 view s
Useful Information about W orkflow
Background Process Concurrent Program -
8,126 view s
Order to Cash Technical Flow - 7,502
view s
How costing is performed on Inventory
Material Transactions - 7,331 view s
Information about Oracle APIs and How to
find APIs of Oracle Modules? - 7,103 view s
Purpose of Formula column, Summary
column and Place Holder column in Oracle
Reports - 6,666 view s
11 Reasons for a Sales Order to get
Backordered! - 5,020 view s
RICE, CEMLI Terminology in Oracle Apps -
4,931 view s
Recent Comments
Recent Comments
Shashi Kiran One more reason for
backorder: In an Oracle W arehouse
Management enabled organization,
you must specify the staging subinventory
and locator w ithin the pick release criteria.
If you fail to specify...
11 R e a sons for a Sa le s O rde r to ge t
Ba ck orde re d! · 4 da ys a go
Shailender Thallam Sure Prashant, I
w ill make some effort to w rite on
Interfaces and Conversions.
W ha t is the role of a Functiona l C onsulta nt in
Support a nd Im plem e nta tion Proje ct? · 1 we e k
a go
Shailender Thallam Hello Rambo,
Since the records are in 'Ready'
status, I hope scheduling three
separate W orkflow Background processes
- one each for timeout, deferred and stuck
w ould solve the problem. Thanks,...
Use ful Inform a tion a bout W ork flow Ba ck ground
Proce ss C oncurre nt Program · 1 we e k a go
Rambo hi, Thanks for sharing this
useful information. In my

EBS Reporting
Webinar
Join Us for Our Oracle E-Business
Suite Reporting Tool Webinar.
conve rte d by W e b2PDFC onve rt.com
environment w e alw ays have very high
ready count w hen I check from
w f_deferred_table_m (more than 70K
sometimes). W hat do you suggest in
this...
Use ful Inform a tion a bout W ork flow Ba ck ground
Proce ss C oncurre nt Program · 1 we e k a go
© 2014 OracleAppsDNA. Opinions expressed here are strictly those of the ow ner, Shailender
Thallam, and those of the commenters. Articles cannot be reproduced w ithout permission from the
author.
OracleAppsDNA
conve rte d by W e b2PDFC onve rt.com

S-ar putea să vă placă și