Solved

Reading Result Set with a Cursor

Posted on 2010-09-23
2
354 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JavaScript/Java - Changing an image background color 4 54
stackato and cloud 4 64
grouping on time windows 6 41
SQL query question 8 31
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This video shows how to recover a database from a user managed backup
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

932 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

12 Experts available now in Live!

Get 1:1 Help Now