[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 373
  • Last Modified:

Reading Result Set with a Cursor

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
shepp_it
Asked:
shepp_it
1 Solution
 
slightwv (䄆 Netminder) Commented:
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
 
shepp_itAuthor Commented:
Awesome. Thank you.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now