IBM developerWorks
           Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old January 14th, 2005, 01:12 PM
code.commander code.commander is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 25 code.commander User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 41 sec
Reputation Power: 0
Stored Procedure and Cursor

Hello...

I have created a stored procedure as follows:

PROCEDURE P_GET_CURRICULUM_BY_PARENT
(
pPARENT IN PERSON.PARENT%TYPE,
pCURSOR OUT types.ref_cursor
)

AS

BEGIN
OPEN pCURSOR FOR
SELECT ID, NAME, AS PARENT
FROM PERSON
WHERE PARENT= pPARENT;
END;


However, no matter what I do, when I attempt to compile the stored procedure... I receive the following error:

PLS-00201: identifier 'TYPES.REF_CURSOR' must be declared

This is a brand new database. I was able to create the tables just fine. This is the first stored procedure I am trying to enter into the database. The DBA swears that I have the necessary permissions.

Thanks,
Chad

Reply With Quote
  #2  
Old January 14th, 2005, 04:27 PM
jim mcnamara jim mcnamara is offline
......@.........
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Posts: 1,307 jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 28 m 57 sec
Reputation Power: 48
Code:
/* This part has to be either in the DECLARE section or in the pacakge specification. */
DECLARE
TYPE Detail_Record_Type IS RECORD (
     v_ID     PERSON.ID%TYPE,
     v_NAME   PERSON.NAME%TYPE

);
TYPE Detail_Cursor_Type IS REF CURSOR RETURN Detail_Record_Type;

/* change your declaration to something like this : */
PROCEDURE P_GET_CURRICULUM_BY_PARENT
(
   pPARENT IN PERSON.PARENT%TYPE,
   pCURSOR OUT Detail_Cursor_Type;
)

AS

BEGIN
OPEN pCURSOR FOR
SELECT ID, NAME, AS PARENT
FROM PERSON
WHERE PARENT= pPARENT;
END;
/

Reply With Quote
  #3  
Old January 17th, 2005, 07:44 AM
code.commander code.commander is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 25 code.commander User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 41 sec
Reputation Power: 0
Thank you

Thank you very much, it worked like a charm!

Quote:
Originally Posted by jim mcnamara
Code:
/* This part has to be either in the DECLARE section or in the pacakge specification. */
DECLARE
TYPE Detail_Record_Type IS RECORD (
     v_ID     PERSON.ID%TYPE,
     v_NAME   PERSON.NAME%TYPE

);
TYPE Detail_Cursor_Type IS REF CURSOR RETURN Detail_Record_Type;

/* change your declaration to something like this : */
PROCEDURE P_GET_CURRICULUM_BY_PARENT
(
   pPARENT IN PERSON.PARENT%TYPE,
   pCURSOR OUT Detail_Cursor_Type;
)

AS

BEGIN
OPEN pCURSOR FOR
SELECT ID, NAME, AS PARENT
FROM PERSON
WHERE PARENT= pPARENT;
END;
/

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Stored Procedure and Cursor


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway