views:

47

answers:

3

I'm using Java to connect to an Oracle 10 Database. I want to create a stored procedure (don't ask why) that takes no arguments and returns a lot of rows. Specifically, in Java I want to be able to get this data with something like:

ResultSet rs = stmt.executeQuery("call getChildless");

where getChildless is the query:

SELECT objectid
FROM Object
WHERE objectid NOT IN (SELECT parent FROM subparts);

However, I just cannot for the life of me figure out how to get my output from the stored procedure. I've googled it and I get all this sample code that Oracle won't compile, presumably it's for a previous version. Refcursors seem to come up a lot, but I'm not sure if that's what I actually want, to use it with a ResultSet.

A: 

I presume Oracle JDBC is like MS-SQL JDBC...

while (rs.next())
{
    myint = rs.getInt(1);
}
Chris Nava
A: 

JDBC is dynamically typed, It does not make sense that it would not compile. See this link to the JDBC Tutorial

Romain Hippeau
A: 

Take a look at http://stackoverflow.com/questions/2915868/retrieving-oracle-cursor-with-jdbc. Does that give you what you need?

Dave Costa