• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getting ResultSet from Oracle procedure

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic