DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: DBMS_OUTPUT a Cursor??

  1. #1
    Join Date
    Jan 2001
    Posts
    515
    I have

    declare

    x mypackage.gencursor;

    begin

    mypackage.myprocedure(x);

    for v1 in x loop

    dbms_output.put_line(x.name);

    end loop;

    end;
    /

    The x is a out parameter of myprocedure. It is a cursor called gencursor. I am trying to print the values but it is not working. Does anyone know what I am doing wrong?

    I am getting the following error message:

    declare
    *
    ERROR at line 1:
    ORA-06550: line 9, column 11:
    PLS-00221: 'X' is not a procedure or is undefined
    ORA-06550: line 9, column 1:
    PL/SQL: Statement ignored


  2. #2
    Join Date
    Jan 2001
    Posts
    515

    correction

    I gave you the program wrong. It was like this:


    declare

    x mypackage.gencursor;

    begin

    mypackage.myprocedure(x);

    for v1 in x loop

    dbms_output.put_line(v1.name);

    end loop;

    end;
    /

  3. #3
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    In the Cursor FOR loops you cannot use already opened cursor. A solution might be:
    Code:
    declare
    x mypackage.gencursor;
    name varchar2(100);
    begin
    mypackage.myprocedure(x);
    loop
       fetch x INTO name;
       exit when x%notfound;
       dbms_output.put_line(name);
    end loop;
    close x;
    end;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width