Solved

Cursor problem when running Oracle stored procedure in TOAD

Posted on 2004-10-08
4
4,599 Views
Last Modified: 2012-05-05
Why do I get this error when running (RT Click=>Execute Procedure) a stored procedure in Toad?
Your help is much appreciated, as I toil from my humble abode.

ORA-06550: line 2, column 14:
PLS-00201: identifier 'CURSOR' must be declared
ORA-06550: line 2, column 10:
PL/SQL: Item ignored

The spec, where Cursortype is defiend, is separate from the procedure.  Do I need to define the type in the Begin code in the Toad dialog box?

CREATE OR REPLACE package Pkg_Sales As
  TYPE CURSORTYPE IS REF CURSOR;

Function A_Summary(ParmEndDate char, ParmTimePeriod char, ParmBusinessUnit char,
             ParmEntity char) return Cursortype;
...other functions defined in .sps...

...spb code:...
Function A_Summary(ParmEndDate char, ParmTimePeriod char, ParmBusinessUnit char, ParmEntity char) return Cursortype is
     Result_Set Cursortype;

Generated Toad Code:
DECLARE
   
  RetVal REF CURSOR;
  PARMENDDATE CHAR(200);
  PARMTIMEPERIOD CHAR(200);
  PARMBUSINESSUNIT CHAR(200);
  PARMENTITY CHAR(200);

BEGIN
  PARMENDDATE := '2004-02-29';
  PARMTIMEPERIOD := 'M';
  PARMBUSINESSUNIT := 'Retail IC';
  PARMENTITY := NULL;

  RetVal := EI.PKG_SALES.A_SUMMARY ( Parms...)
0
Comment
Question by:andjesdav
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 9

Assisted Solution

by:konektor
konektor earned 50 total points
ID: 12259542
u should :
DECLARE
  TYPE tRefCur IS REF CURSOR;
  RetVal tRefCur;
...
0
 
LVL 23

Expert Comment

by:seazodiac
ID: 12259579
I think it should be:

TYPE CURSORTYPE IS SYSREFCURSOR;

then declare:

RetVal CURSORTYPE;
0
 
LVL 15

Accepted Solution

by:
andrewst earned 50 total points
ID: 12259706
In 9i, just use:

Retval SYS_REFCURSOR;

SYS_REFCURSOR is a pre-declared REF CURSOR type.
0
 

Author Comment

by:andjesdav
ID: 12260203
Thanks!  Konektor's worked and was first, Andrewst's worked, too, and is shorter.
Now I have to find out how to see the results, but I think that's already been asked, so I'll look it up.
Ribbeting.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question