[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Reading Result Set with a Cursor

Posted on 2010-09-23
2
Medium Priority
?
368 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 2000 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
Suggested Courses

656 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