1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| set serveroutput on
declare
type tab_ename_type is table of scott.emp.ename%type index by binary_integer;
tab_ename tab_ename_type;
type tab_deptno_type is table of scott.emp.deptno%type index by binary_integer;
tab_deptno tab_deptno_type;
i binary_integer := 1 ;
begin
for emp_record in (select ename , deptno from scott.emp where empno < 8000)
loop
tab_ename(i):= emp_record.ename;
tab_deptno(i) :=emp_record.deptno;
i := i+1 ;
end loop;
for i in 1..15
loop
dbms_output.put_line(tab_ename(i) ||'-'||tab_deptno(i));
end loop ;
end ; |