• 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

resultset type

 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
good day,
i use connection.preparecall to call a procedure that returns some rows.
my java code has to do something with the last row returned. so, in order to perform that logic, i could comeup with only two options

1. we have to find out the total rows returned which can be done in the procedure. is there a way to find the total rows returned by the cursor, without doing looping and fetching.

2. use resultset.isLast(). i have used the following code.
callableStatement = connection.prepareCall("{call Pkg_test.prget(?,?,?)}", ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
but somehow the type is reset to TYPE_FORWARD_ONLY by the driver. why is my type not feasible. due to this, i couldn't use isLast().

have a nice day,
krishna prasad
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not use ORDER BY to change the order around so the last item now is the first item then, also combined with a limitation on the number of rows (TOP 1 in MS SQL Server, LIMIT 0 in MySQL).
 
yeah, but ... what would PIE do? Especially concerning this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic