Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Returning of More than one resultset

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Javaranch!Can any one please inform me under what circumstances does the execute method return more than one resultset.(It is mentioned in the api for the execute ethod of PreparedStatement).If more than one resultset is returned how to handle them.kindly give the dcode snippet which does this.
Thanking you in advance.
Clkanth
 
Paul Caudle
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there, clkanth, I think the api is referring to handling more than one result, rather than more than one ResultSet.
The execute method can support any sql including ones which alter multiple tables in the database, and will return true or false according to if the changes to the database were successful or not. The internal workings of this method allow
(somehow, I have no idea how) verification of changes to each of these tables. This is what the api means by multiple results. By the time the method returns a boolean, it has combined the results (successes or failures of each part of the SQL) into either one big yes or one big no.
That is my view of how the execute method works and may not be what is truly going on but from looking at the api spec that is what it looks like to me.
hope that helps,
Paul
 
Ray Marsh
Ranch Hand
Posts: 458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"clkanth", take a look at this link: http://www.javaranch.com/ubb/Forum10/HTML/000180.html
 
Monty Ireland
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Point#1 Executing more than on sql statement at the same time.
Thus, you may have more than one ResultSet available to process at the same time.
Point#2 I think the JDBC2.0 standard. Extended features...
Allows a Stored Procedure to return more tha one result set.
Very advanced stuff... Not for the faint of heart...
Please correct me if i am wrong
Any other opinions?
------------------
We learn more from our mistake's than fom our success's.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic