Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Packages passing REF CURSOR between procedures:

Packages passing REF CURSOR between procedures:

From: Shawn Ferris <Shawn.Ferris_at_twtelecom.com>
Date: Wed, 31 May 2000 11:29:56 -0600
Message-Id: <10514.107338@fatcity.com>


I have a package. (sample code to follow) This package has several procedures.

One is the parent procedure and calls the rest. The "child" procedures need to return a cursor reference to the top level procedure.

When I try to compile this package it complains:   PLS-00201: identifier 'RET_CSR' must be declared

Now I've passed REF CURSORS via OCI, but never between procedures. What am I missing? Obviously I need to declare it but where and how?

Oracle 8.1.5, Solaris 2.6+(?)

TIA
Shawn M Ferris
Oracle DBA - Time Warner Telecom

Sample code:
CREATE OR REPLACE PACKAGE test
AS

  TYPE my_cursor IS REF CURSOR;

  procedure parent(value number);
  procedure child1(ret_csr IN OUT my_cursor);
  procedure child2(ret_csr IN OUT my_cursor);

END test;
/

CREATE OR REPLACE PACKAGE test
AS

  TYPE my_cursor IS REF CURSOR;

  procedure parent(value number);
  procedure child1(ret_csr IN OUT my_cursor);
  procedure child2(ret_csr IN OUT my_cursor);

END test;
/

CREATE OR REPLACE PACKAGE BODY test
AS

PROCEDURE parent (value number)
IS
BEGIN
  IF value = 1
  THEN
     child1(ret_csr);
  ELSE
     child2(ret_csr);
  END IF;   FOR record IN ret_csr LOOP
    dbms_output.put_line('Procedure: '||record.proc);   END LOOP; END parent;

PROCEDURE child1(ret_csr IN OUT my_cursor) IS
BEGIN
  OPEN ret_csr FOR
    select 'child1' proc from dual;
END child1;

PROCEDURE child2(ret_csr IN OUT my_cursor) IS
BEGIN
  OPEN ret_csr FOR Received on Wed May 31 2000 - 12:29:56 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US