-- emp_cursor_varray1.txt
DECLARE
CURSOR c_emps is SELECT ename, empno FROM emp;
type c_list is varray (14) of emp.ename%type;
type c_id is varray(14) of emp.empno%type;
name_list c_list := c_list(); id_list c_id :=c_id();
counter integer :=0;
BEGIN
FOR i IN c_emps LOOP
counter := counter + 1;
name_list.extend; id_list.extend;
name_list(counter) :=i.ename;
id_list(counter) :=i.empno;
dbms_output.put_line('Employee('||counter ||'):'||name_list(counter)
||' '|| id_list(counter));
END LOOP;
END;
/