DECLARE
TYPE REFCUR_EMP_TYPE IS REF CURSOR;
rcur_emp REFCUR_EMP_TYPE;
PROCEDURE process_emp_cur(rcur_emp IN REFCUR_EMP_TYPE) IS
l_emp emp%ROWTYPE;
BEGIN
dbms_output.put_line('Emp table details');
loop
fetch rcur_emp into l_emp;
exit when rcur_emp%notfound;
dbms_output.put_line('Empno : '|| l_emp.empno);
dbms_output.put_line('Ename : '|| l_emp.ename);
end loop;
END;
BEGIN
OPEN rcur_emp FOR select * from emp where rownum < 2;
process_emp_cur (rcur_emp);
CLOSE rcur_emp;
END;
No comments:
Post a Comment