How to display the contents of a current record fetched in a reference cursor?

Questions by madhuk17   answers by madhuk17

Showing Answers 1 - 6 of 6 Answers

To display the cursorOPEN v_cursor FOR SELECT ename, empno, deptno FROM emp WHERE deptno = p_deptno ORDER BY ename;LOOP FETCH v_cursor INTO v_ename, v_empno, v_deptno; EXIT WHEN v_cursor%NOTFOUND; DBMS_OUTPUT.PUT_LINE(v_ename || ' | ' || v_empno || ' | ' || v_deptno); END LOOP; CLOSE v_cursor;

  Was this answer useful?  Yes

Vishakha

  • Feb 17th, 2007
 

 

declare

cursor v_cursor is

      select empno, empnm, empdept from emp where empdept = 10;

begin

      open v_cursor;

      loop

      fetch v_cursor into c_empno, c_empnm, c_empdept;

      exit when v_cursor%notfound;

      dbms_output.put_line(c_empno || ' | ' || c_empnm || ' | ' || c_empdept );

      end loop;

      close v_cursor;

end;

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions