Advertisement

07.07.2008 at 10:03PM PDT, ID: 23545526
[x]
Attachment Details

Oracle stored procedure, return recordset, declare cursor

Asked by dobbinjp in PL / SQL, Oracle 10.x

Tags:

I am very new to Oracle stored procedures. I am trying to return a recordset from my Oracle database using a SQL query (inside a stored procedure) with one input parameter. I understand I need to use a ref cursor, but I am having difficulty with compiling code based on examples I have seen here and other places on the web.

The concept is simple, I have a table of counties and there are 4 regions in the state. When the user submits a region (region_param), the stored procedure should return a list of counties. Eventually, this stored procedure will serve an XML-based web service and populate drop-downs, etc. I want to crawl before I run, though. I will ask how to return this to a web service once I get stored procedures figured out.

The error code I keep getting is "TYPES.cursorType must be declared." Here is the code I have so far...any help on syntax is appreciated!Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
CREATE OR REPLACE PROCEDURE getcounty
  (region_param IN NUMBER,
   resultset out TYPES.cursorType)
 
AS BEGIN
 
OPEN resultset FOR
 
    SELECT co_name
    FROM county
    WHERE county.region = region_param;
 
END getcounty;
[+][-]07.07.2008 at 11:25PM PDT, ID: 21951335

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.08.2008 at 12:58AM PDT, ID: 21951776

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.08.2008 at 10:16AM PDT, ID: 21955937

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.08.2008 at 04:41PM PDT, ID: 21959369

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.08.2008 at 06:53PM PDT, ID: 21960022

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PL / SQL, Oracle 10.x
Tags: Oracle PL/SQL
Sign Up Now!
Solution Provided By: sujith80
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.09.2008 at 09:25AM PDT, ID: 21965477

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.10.2008 at 01:05AM PDT, ID: 21971303

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628