cursor.sql
declare cursor c1 is select sal,empno from emp_oracle; temp number(10); c1rec c1%rowtype; tmp number(3); type emp_tab is table of emp_oracle%rowtype index by binary_integer; emp_tab_table emp_tab; i binary_integer; begin open c1; loop fetch c1 into c1rec; exit when c1%notfound; emp_tab_table(i).empno:=c1rec.empno; emp_tab_table(i).sal :=c1rec.sal; dbms_output.put_line('sal='||to_char(c1rec.sal)); close c1; end loop; select count(*) into tmp from emp_oracle; for i in 1..tmp loop dbms_output.put_line('i='||i||' '||to_char(emp_tab_table(i).empno)||' '||to_char(emp_tab_table(i).sal)); end loop; end;