Can I set the value of a cursor inside of a loop? I'm new to SQL, so I apologize if this is a basic question. The variable in question is c2.
declare
type NumberArray is array(100) of clock_in_out.pr_emp_id%Type;
type DateArray is array(1000) of clock_in_out.time_in_out%TYPE;
emps NumberArray;
times DateArray;
cursor c1 is select unique pr_emp_id from clock_in_out;
cursor c2;
BEGIN
open c1;
fetch c1 bulk collect into emps;
close c1;
FOR i IN emps.FIRST .. emps.LAST
LOOP
c2 is select time_in_out from clock_in_out where pr_emp_id = emps(i) order by time_in_out;
open c2;
fetch c2 bulk collect into times;
close c2;
END LOOP;
END;