Passing a Cursor from Procedure to a Package Spec using REF cursor
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Passing a Cursor from Procedure to a Package Spec using REF cursor

  1. #1
    Join Date
    Mar 2002
    Posts
    25

    Question

    Is it right to pass a Cursor to a (REFERRNECE CURSOR) P_CURSOR OUT pkg_t.SPCUR Package spec like I am doing in the Procedure. When I execute the procedure, I pass in the one parameters as follows: exec sp_emp_request(‘Smith’) to get a cursor back in the Package.

    But when executed, it keeps generating the following error:
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'SP_EMP_REQUEST'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored

    Is there some other thing that I have to do for the Procedure to execute successfully?

    CREATE OR REPLACE package pkg_t
    AS
    TYPE spcur IS REF CURSOR;
    END pkg_t;
    /

    CREATE OR REPLACE PROCEDURE sp_emp_request
    (Ename IN VARCHAR2,
    P_CURSOR OUT PKG_T.SPCUR )
    AS
    BEGIN
    OPEN P_CURSOR FOR
    SELECT * FROM EMP;

    END sp_emp_request;

    Any advise on what to do or what I am doing

  2. #2
    Join Date
    Dec 2001
    Location
    Brazil
    Posts
    282


    your procedure has two parameters, doesn't it? So, you have to pass two parameters, you passed only one ('Smith').

    eg ('Smith', variable)


    F.


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