• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Retrieve Number of Rows Affected in Calling Stored Procedure

 
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have an insert statement that is embedded in a stored procedure call, please see my code.



Now what I want is to retrieve the number of rows affected. In plain JDBC, the callable statement is returning the number of rows affected this is for me to add logic
so that I will know that the Insert/Update procedure was successful.

Do you know how to do this? I have tried the class SqlReturnUpdateCount, but it returns null.

SQLOutParameter "return_value" is not correct also as I do not have a parameter which is an Out Parameter in my stored procedure. I am using MSSQL by the way. Please advise.
 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you checked the Map returned by execute()?
 
Mark Reyes
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lorand,

yes, I have checked the return map but it has no values or entries associated with.
 
Mark Reyes
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I found the cause while making some changes in the db. The culprit is the dreaded Set No Count option which is automatically appended by MSSQL 2008 DB.

Thanks.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

mark reyes wrote:Hi,

I found the cause while making some changes in the db. The culprit is the dreaded Set No Count option which is automatically appended by MSSQL 2008 DB.

Thanks.



Sweet, good catch.

Mark
reply
    Bookmark Topic Watch Topic
  • New Topic