declare TYPE VARCHAR2_ARRAY IS TABLE OF VARCHAR2(100) INDEX BY BINARY_INTEGER; array_list VARCHAR2_ARRAY; cursor c_cur is select ename from emp; begin for c in c_cur loop array_list(c_cur%rowcount) := c.ename; end loop;
for i in 1..array_list.count loop dbms_output.put_line(array_list(i)); end loop; end; /----------------------------- SMITH ALLEN WARD JONES MARTIN BLAKE CLARK SCOTT KING TURNER ADAMS JAMES FORD MILLERPL/SQL procedure successfully completed
declare
TYPE VARCHAR2_ARRAY IS TABLE OF VARCHAR2(100) INDEX BY BINARY_INTEGER;
array_list VARCHAR2_ARRAY;
cursor c_cur is select ename from emp;
begin
for c in c_cur
loop
array_list(c_cur%rowcount) := c.ename;
end loop;
for i in 1..array_list.count
loop
dbms_output.put_line(array_list(i));
end loop;
end;
/-----------------------------
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLERPL/SQL procedure successfully completed