Solved

Reading Result Set with a Cursor

Posted on 2010-09-23
2
353 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
2 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
Comment Utility
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
Comment Utility
Awesome. Thank you.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump 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 …

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now