PL/SQL (MOSC)

MOSC Banner

How to copy a cursor variable?

edited Jun 22, 2012 2:17AM in PL/SQL (MOSC) 9 commentsAnswered
  Hallo,
I declared 2 cursors in my procedure, but I want to open only one at the time and do the same thing.
I do not want to use dynamic SQL (ref cursor and query string). In the real procedure it's better to use static SQL.
This code (THAT DOESN'T WORK) explain better my intentions:

DECLARE
   --TYPE T_Conrad IS REF CURSOR;
   C_Conrad    SYS_REFCURSOR;
   L_Purpose   VARCHAR2 (25);
   CURSOR C_Phone
   IS
      SELECT 'TELEPHONE' FROM DUAL;
   CURSOR C_Fax
   IS
      SELECT 'FAX' FROM DUAL;
BEGIN
   FOR I IN 1 .. 2
   LOOP
      IF I = 1
      THEN
         C_Conrad := C_Phone;
      ELSIF I = 2
      THEN
         C_Conrad := C_Fax;

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center