bulk collect and variables(how to create runtime variable)
ShackirMar 7 2012 — edited Mar 8 2012Hi friends,
I'm trying to use bulk collect instead of Cursor in my PLSQL block, But i'm facing one problem that the size of variable. Becuase the variable size must be given at the time of Compilation. where I need to give the size dynamically at runtime.. There is any other variable/or other way to solve this problem.
For Eg:-
declare
type my_arr is varray(100) of number;
lv_arr my_arr;
begin
select eno bulk collect into lv_arr from emp;
end;
Here array size is 100 and is fixed. But in my table i'm having more than 100 will give error. So i need to use any other variable which can hold unlimited values. My requirement is like this
1. First i will find the count of records from my table.
2. Based on this value i need to create a new variable to hold all the values. So it will not raise any error
Thanks in advance