Home > Ask the Oracle Experts > Database Design and Architecture Questions & Answers > How to implement a ref cursor called in a stored procedure
Ask The Oracle Expert: Questions & Answers
EMAIL THIS

How to implement a ref cursor called in a stored procedure

Brian Peasland EXPERT RESPONSE FROM: Brian Peasland

Pose a Question
Other Oracle Categories
Meet all Oracle Experts
Become an Expert for this site


Oracle tips, scripts, and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 14 May 2008
I read your answer on calling the stored procedure from another procedure. On the base of this, I want to call another procedure, which has some cursor (output) parameters. The way I am doing it is as follows:


CREATE OR REPLACE PROCEDURE DEVELOPER.SPGETPORTLETSANDINSTANCES(
USERID IN NUMBER,
CR_PORTLETS OUT SYS_REFCURSOR ,
CR_PORTLETINSTANCES OUT SYS_REFCURSOR
)
AS

BEGIN

    
    DEVELOPER.SPGETPORTLETS(CR_PORTLETS);
    
    DEVELOPER.SPGETPORTLETINSTANCES(USERID, CR_PORTLETINSTANCES);

   EXCEPTION
     WHEN NO_DATA_FOUND THEN
       NULL;
     WHEN OTHERS THEN
       -- Consider logging the error and then re-raise
       RAISE;
END SPGETPORTLETSANDINSTANCES;
/

When I run this procedure, it gives the following procedure:
ORA-00604: error occurred at recursive SQL level 1
ORA-01001: invalid cursor

Can you tell me what the problem with this is?


>
EXPERT RESPONSE
The following has a nice example of how to implement a ref cursor called in a stored procedure:

How to Use the SYS_REFCURSOR and REF CURSOR in the Oracle Stored Procedure and Function

Otherwise, you will probably have to diagnose the ORA-604 error. I answered this question previously as can be seen here:

Getting ORA-00604 error when connecting to database user


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
Database Design and Architecture
Should we worry about Oracle memory leaks on Windows?
How to disable Oracle constraints and triggers during an import in 10g
How to delete a partition on the F: drive with Oracle on Windows
What could be causing an SQL count 0 with a successful Oracle import?
What is a staging table, and how is the staging concept used in Oracle?
Tips for how to size an Oracle server
Oracle error 942 when exporting a schema
Do DDL statements roll back, and why?
Increasing Oracle storage capacity by moving to a new storage with minimum downtime
Using Undo Tablespaces vs. rollback segments in Oracle 9i, 10g

Oracle database administration (DBA)
Should we worry about Oracle memory leaks on Windows?
How to disable Oracle constraints and triggers during an import in 10g
How to delete a partition on the F: drive with Oracle on Windows
What is a staging table, and how is the staging concept used in Oracle?
What could be causing an SQL count 0 with a successful Oracle import?
Is a hot backup part of a backup database using RMAN?
How does Oracle instance recovery work and what happens internally?
How to configure Oracle DB_BLOCK_SIZE and Solaris operating system block size
How to back up Oracle 10g RAC database on an AIX system
Tips for using parameters in an Oracle dump file import
Oracle database administration (DBA) Research

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice

HomeNewsTopicsTipsAsk the ExpertsMultimediaWhite PapersProductsBlogs
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2003 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts