<department>
| dno | dname | loc |
|---|---|---|
| 10 | ACCOUNTING | NEW YORK |
| 20 | RESEARCH | DALLAS |
| 30 | SALES | CHICAGO |
| 40 | OPERATIONS | BOSTON |

set serveroutput on
declare
v_dept department%rowtype;
cursor c1
is
SELECT * FROM department;
begin
open c1;
loop
fetch c1 into v_dept.dno, v_dept.dname, v_dept.loc;
exit when c1%notfound;
dbms_output.put_line(v_dept.dno||', '||v_dept.dname||', '||v_dept.loc);
end loop;
close c1;
end;
/
set serveroutput on
declare
v_dept department%rowtype;
cursor c1
is
SELECT * FROM department;
begin
for v_dept in c1 loop
exit when c1%notfound;
dbms_output.put_line(v_dept.dno||', '||v_dept.dname||', '||v_dept.loc);
end loop;
end;
/
참고 : 서적 'Oracle 11g 프로그래밍'