declare cursor c1( empno in number) is select empno,ename from emp where empno=empno; begin for rec_set in c1(7369) loop dbms_output.put_line('empno' || rec_set.empno || ' ename ' || rec_set.ename); end loop; end;
The question is what's the point of the collection?
DECLARE CURSOR get_all_locations (type IN VARCHAR2) IS SELECT * FROM group WHERE type = type; TYPE t_all_locations is TABLE OF get_all_locations%ROWTYPE INDEX BY PLS_INTEGER; v_all_locations t_all_locations; BEGIN OPEN get_all_locations; FETCH get_all_locations BULK COLLECT INTO v_all_locations; CLOSE get_all_locations; END;
Oh, and I wouldn't use "type" as name for a column or variable.
CURSOR get_all_locations (type IN VARCHAR2) IS SELECT * FROM group WHERE *type = type*;
You have a (poor) solution in search of a problem.You do not know what the problem is and you do not know the solution.
PL/SQL will never be faster than plain SQL to access data within Oracle DB.