Solved

Reading Result Set with a Cursor

Posted on 2010-09-23
2
359 Views
Last Modified: 2013-12-19
Hi, I have following SQL statement.
SELECT E.ID, E.NAME,
CURSOR(SELECT F.MEMBER, F.AGE FROM CLIENT F WHERE F.ID = E.ID)
FROM EMPLOYER E

If I run something like this in Java:
ResultSet rs = statement.executeQuery(sql);

I can read E.ID and E.NAME using rs.getString(1), but how do I read the values in the cursor?

Thanks in advance
0
Comment
Question by:shepp_it
[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
2 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 33749625
I'm not a Java guy and I've never even tried this using .Net.  Are you declaring data types for the returned values?

set up an alias for the cursor:
SELECT E.ID, E.NAME,
CURSOR(SELECT F.MEMBER, F.AGE FROM CLIENT F WHERE F.ID = E.ID) myCur
FROM EMPLOYER E

You should be able to use getObject (or similar) for e.myCur.

Check out the refcursor Java code at:
http://www.databasedesign-resource.com/oracle-ref-cursor-in-java.html
0
 

Author Comment

by:shepp_it
ID: 33749731
Awesome. Thank you.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

739 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