| Author |
getting ResultSet from Oracle procedure
|
Amit Da
Greenhorn
Joined: Mar 07, 2003
Posts: 16
|
|
I am trying to get a ResultSet object by executing a stored procedure in Oracle. The ResultSet is one of the parameters of this procedure. Typical code: CallableStatement st = cn.prepareCall("{ call sc_getkeyfieldinfo(?,?) }"); st.setMaxRows(2); //this doesnt do anything st.setString(1, "T11_2003_1"); st.registerOutParameter(2, OracleTypes.CURSOR); st.execute(); ResultSet rs = (ResultSet) st.getObject(2); while (rs.next()) { System.out.println(rs.getString(1)); } How would I get only certain number of rows in my ResultSet ? The setMaxRows on a callable statement did not do anything. Neither does the setFetchSize(). When we get a ResultSet directly by executing a query from a Statement, these maxSize and fetchSize parameters set there do the job and return a ResultSet of specified size(# of rows). But on a CallableStatement it didn't do anything. Anyone knows how to achieve this ??? Amit [ September 18, 2003: Message edited by: dalAm ]
|
 |
Wayne L Johnson
Ranch Hand
Joined: Sep 03, 2003
Posts: 399
|
|
I've run into the same issue with Oracle. The best solution I've found is a bit ugly--you don't rely on Oracle to do it: You can easily control the number of results to process.
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
Howdy dalAm, Welcome to Javaranch!! I have to tell you that your display name does not follow our Naming Policy which we really get our kicks on inforcing. It makes us feel important. Anyway, you can change your display name by clicking here and editing your profile. Thanks for conforming to the masses and we hope to see you around here often.
|
 |
 |
|
|
subject: getting ResultSet from Oracle procedure
|
|
|