I have a cursor query which returns me record of two tables like below.
cursor c1 is
select teb.*,te.*
from table1 teb, table2 te
where te.col1=teb.col2;
How should I collect them in Collections using bulk collect?
I tried:
type tab_rec is table of table1%rowtype index by pls_integer;
var_rec tab_rec;
type tab_rec1 is table of table2%rowtype index by pls_integer;
var_rec1 tab_rec1;
begin
open c1;
fetch c1 bulk collect into var_rec,ver_rec1;
close c1;
But above doesn't seem to be working.
Reading the fine manual: %ROWTYPE Attribute
The
%rowtype
attribute works also with cursors:See also this example from Oracle documentation.