Here is an example of how you can iterate through objects in the table type:
declare
l_task_rec tas_tab;
p_location_id number;//Assuming number
begin
--Example data
l_task_rec:=tas_tab( l_task_type_rec (10, sysdate), l_task_type_rec (21, sysdate), l_task_type_rec (35, sysdate));--This should come from somewhere else
for counter in l_task_rec.first .. l_task_rec.last
loop
--You can get the data like this
DBMS_OUTPUT.PUT_LINE('TASK_ID: '||l_task_rec(counter).TASK_ID);
DBMS_OUTPUT.PUT_LINE('CREATION_DATE: '||l_task_rec(counter).CREATION_DATE);
select location_id into p_location_id from csf_ct_tasks where task_id = l_task_rec(counter).TASK_ID;
--More code
--OPEN ...
--CLOSE ...
end loop;
end;
In order for this to work, I changed how l_task_type_rec
type is created:
create TYPE l_task_type_rec is object (task_id number, creation_date date)