Else PGA would burdened
V.Hariharaputhran, April 19, 2010 - 11:21 am UTC
It is exactly doing what it is suppose to do, if not just imagine the purpose of LIMIT would be meaning less.
Begin
............
cursor c1 is select * from emp;
begin
open c1;
loop
fetch c1 bulk collect into lv_emp_type limit 100;
exit when lv_emp_type.count=0;
end loop;
end;
If the bulk collect is going to pile data even by having limit as 100, it would over burden your PGA-memory and ultimately end with "out of memory".
Regards
V.Hari
April 19, 2010 - 11:28 am UTC
... if not just imagine the purpose
of LIMIT would be meaning less.
...
no, it wouldn't really, it would just mean that you SHOULD call "array.delete" first...
Bulk collection and Collection Delete
V.Hariharaputhran, April 19, 2010 - 12:16 pm UTC
Mr.Oracle
Preety fast reply :), Iam gifted.
You Said
.......you SHOULD call "array.delete" first
With respect to associative arrays,i really haven't done this array.delete step till date just before bulk fetch because i know the flow of the code.
Or Does it means that oracle internally does array.delete before performing bulk collect.
Or Do you mean freeing memory,making room every time before bulk fetch.
Iam getting confused with this statement indicating to perform array.delete before bulk fetch.
Regards
V.Hari
April 19, 2010 - 12:42 pm UTC
Or Does it means that oracle internally does array.delete before performing bulk collect.
Yes, a bulk collect empties the array AND THEN fills it again with 0 or more items.
It differs from a single row fetch which does not do that.
before you fetch bulk collect into l_array, you do not need to .delete it.
In the above, when I said should to the last poster, it was in response to their hypothetical situation, they said bulk collect would be useless if it did not work that way - I disagreed saying that IF it worked that when THEN you should call .delete
But it doesn't work in that hypothetical way, you need not call .delete to reset the array between bulk collects.