|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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;
/
|
|
#3
|
|||
|
|||
|
Thank you
Thank you very much, it worked like a charm!
Quote:
|
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Stored Procedure and Cursor |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|