create or replace procedure varry_test as
TYPE emp_type IS RECORD (emp_id number,emp_name varchar2(100),emp_gender varchar(100));
TYPE emp_type_array IS TABLE OF emp_type INDEX BY BINARY_INTEGER;
emp_rec_array emp_type_array;
emp_rec emp_type;
p_data emp%rowtype;
type my_cursor is ref cursor;
p_cc my_cursor;
p_count number;
BEGIN
open p_cc for ''select t.id,t.name,t.salary from emp t'';
p_count :=1;
loop
fetch p_cc into p_data;
exit when p_cc%notfound;
emp_rec.emp_id := p_data.id;
emp_rec.emp_name := p_data.name;
emp_rec.emp_gender := p_data.salary;
emp_rec_array(p_count) := emp_rec;
p_count := p_count+1;
end loop;
FOR i IN 1..emp_rec_array.count LOOP
DBMS_OUTPUT.PUT_LINE(''emp_id = '' || emp_rec_array(i).emp_id
|| '' emp_name = '' || emp_rec_array(i).emp_name
|| '' emp_gender = '' || emp_rec_array(i).emp_gender);
END LOOP;
END;