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

Thread: cursor variables again

  1. #1
    Join Date
    May 2001
    Posts
    5

    Question

    Right what i've got is a situation where I need to pass the table name to a procedure and open the cursor variable in the procedure with the variablr table name ptable when i try to compile this i get the error
    Errors for PACKAGE BODY CURSOR_WEAK:

    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    5/3 PL/SQL: Statement ignored
    5/21 PLS-00201: identifier 'MY_CUR' must be declared
    10/19 PL/SQL: SQL Statement ignored
    10/33 PLS-00201: identifier 'PTABLE' must be declared

    can I not use variables that I have declared in the spec to use in the select statement.


    create or replace package cursor_weak as
    type my_cursor is REF CURSOR;
    procedure open_cursor_data (my_cur in out my_cursor, ptable VARCHAR2);
    procedure get_table_data;
    end;
    /

    create or replace package body cursor_weak as

    procedure get_table_data is
    begin
    open_cursor_data (my_cur, 'data1');
    end;

    procedure open_cursor_data (my_cur in out my_cursor, ptable VARCHAR2) is
    begin
    open my_cur FOR SELECT * FROM ptable;
    end;

    end;
    /
    Suggs

  2. #2
    Join Date
    Apr 2001
    Location
    UK
    Posts
    137
    I think you need to declare a "my_cur" variable in the get_open_data procedure i.e.

    procedure get_table_data is
    my_cur my_cursor;
    begin
    open_cursor_data (my_cur, 'data1');
    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