Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

verifying update in pl/sql

 
Padmanabh Sahasrabudhe
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am running an updated statement thru' the procedure, which is being called from Java. What way can I ensure that the rows are updated?

As I am calling the CallableStatement I have the getUpdateCount method, but this returns something else than what I was looking for.

Here is the code:


I get ConfigurationNotFoundException thrown even if there is proper update. What method should I use to verify if any rows are updated?

Thanks,
Padmanabh
 
Campbell Ritchie
Sheriff
Posts: 48402
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the API documentation for Statement#execute(java.lang.String) and see what it returns. Then go to getUpdateCount and see what it returns.
 
Hemavathy Ramamoorthy Gopal
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

getUpdateCount() ---- used to retrieves the current result as an update count; if the result is a ResultSet object or there are no more results, -1 is returned.

Since procedure is used it will result in -1 so it is throwing expection even if updation is happening correclty, to avoid this exception inside procedure you try to return some value greater than according to your validation if the updation goes fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic