0
votes

I am trying to understand the purpose of REF CURSOR.

Are strong ref cursor and weak cursor still applicable while using a FOR LOOP in a Cursor?

In the example I can use c_post.empid to display in this case.

Example:

DECLARE
CURSOR c_post IS select empid, empname from EMP;

BEGIN

FOR c_post in c_post LOOP

DBMS_OUTPUT.PUT_LINE('The value displayed is ' || c_post.empid);

END LOOP;

END;
1
There is no ref cursor in this example. Only an explicit PL/SQL cursor.Rob van Wijk
A ref cursor is a data structure that holds the reference to the data, you can pass it as a parameter. Do you need such a thing in your example ?A.B.Cade

1 Answers

1
votes

I am not using REF CURSOR in that way. You should try also that:

BEGIN

  FOR r_cur IN (SELECT empid FROM EMP ) LOOP

       DBMS_OUTPUT.PUT_LINE('The value displayed is ' || r_cur.empid);

  END LOOP;

END;

HERE you will find one more example. I hope this example will be useful for you.