declare cursor c_emp(p_cod number DEFAULT 10) is select e.ename , d.dname, e.deptno from emp e , dept d where e.deptno = d.deptno and e.deptno = p_cod; -- 1a declaracao do cursor. r_emp c_emp%rowtype; begin open c_emp; -- 2a etapa | Executou a consulta... loop fetch c_emp into r_emp; -- 3a etapa busca a 1a linha... exit when c_emp%notfound; dbms_output.put_line(c_emp%rowcount || ' ' || r_emp.ename || ' ' || r_emp.dname || ' ' || r_emp.deptno); end loop; close c_emp; -- 4a fecha o cursor e libera memoria end;