
Signature
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
> >> I am not sure how JDBC can return the number of rows updated (or
> >> inserted/deleted) in a stored procedure because there are typically (or at
[quoted text clipped - 36 lines]
> DB2 Solutions Development
> IBM Toronto Lab
Hi. Sybase and MS SQLServer can/do return any mixed series of result
sets and/or update counts
in the order they are obtained at the DBMS, from any SQL batch or
stored procedure.
Joe Weinstein at BEA Systems
Serge Rielau - 22 Nov 2007 00:53 GMT
> Hi. Sybase and MS SQLServer can/do return any mixed series of result
> sets and/or update counts
> in the order they are obtained at the DBMS, from any SQL batch or
> stored procedure.
Joe,
I don't think (??) this is what the OP is asking for.
The OP seems to ask that CALL returns a "grand total".
Resultsets and their associated fetch(!?) counts are a different topic,
IMHO.
Cheers
Serge

Signature
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
> To make a long story short DB2 does not provide this information for a
> CALL statement.
> Now, we're always thriving to improve the product, so I'm curious:
> 1. Which other products support this fucntionality?
This is definitely supported by MS SQL Server.
> 2. is there any documentation in the JDBC client (standard/proprietary,
> ...) or any where else describing it?
The JDBC 3.0 specification (pg 106) says so :-)
> 3. What do you expect to get: ERRD(3) or ERRD(5) see:http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db...
ERRD(3) is what i am after, the rowcount of the last INSERT/DELETE/
UPDATE statement.
> 4. And most importantly: What do you use this information for (i.e.
> what's your business case to pipe back this information through an API
> other than an OUT parameter of a procedure which will truly work cross
> platform.
Sure, the alternative is to use OUT parameters in our application
code. But this is what I am trying to avoid.
We have ported our application suite from MS SQL Server to DB2. We
are able to do this generically as we have a layer (lets call it the
JDBC SDK) that sits between the JDBC Driver and the application code.
Application programs use this JDBC SDK when accessing the database,
and are unaware whether the underlying database is MS SQL Server or
DB2. So, the first prize would be to fix it in the JDBC SDK and then
application programmers would reap the benefits.
Serge Rielau - 26 Nov 2007 02:17 GMT
>> To make a long story short DB2 does not provide this information for a
>> CALL statement.
[quoted text clipped - 7 lines]
>
> The JDBC 3.0 specification (pg 106) says so :-)
Found it. Pretty fuzzy desription :-(
>> 3. What do you expect to get: ERRD(3) or ERRD(5) see:http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db...
>
> ERRD(3) is what i am after, the rowcount of the last INSERT/DELETE/
> UPDATE statement.
The LAST UDI statement of the procedure only?
I'd have guessed that it shoudl contain the SUM of all UDI statement
rowcounts. Can you clarify?
Cheers
Serge

Signature
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Otto Carl Marte - 26 Nov 2007 14:30 GMT
> >> To make a long story short DB2 does not provide this information for a
> >> CALL statement.
[quoted text clipped - 9 lines]
>
> Found it. Pretty fuzzy desription :-(
Indeed. The JDBC spec is not very clear :-( But this is inferred in
the call hierarchy.
Statement -> PreparedStatement -> CallableStatement
Easy to do (from the DB side) for Statement and PreparedStatement
(parameterised statement), less so for CallableStatement.
> >> 3. What do you expect to get: ERRD(3) or ERRD(5) see:http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db...
>
[quoted text clipped - 4 lines]
> I'd have guessed that it shoudl contain the SUM of all UDI statement
> rowcounts. Can you clarify?
The LAST UDI statement rowcount for the procedure is returned. Not the
sum.
Knut Stolze - 27 Nov 2007 13:16 GMT
>> > ERRD(3) is what i am after, the rowcount of the last INSERT/DELETE/
>> > UPDATE statement.
[quoted text clipped - 5 lines]
> The LAST UDI statement rowcount for the procedure is returned. Not the
> sum.
That doesn't make much sense to me. Why the last and not the first? Or the
3rd?

Signature
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Otto Carl Marte - 27 Nov 2007 16:31 GMT
> >> > ERRD(3) is what i am after, the rowcount of the last INSERT/DELETE/
> >> > UPDATE statement.
[quoted text clipped - 13 lines]
> DB2 z/OS Utilities Development
> IBM Germany
Yeah, it isn't very convincing, but its the truth :-)
Knut Stolze - 29 Nov 2007 09:44 GMT
>> >> > ERRD(3) is what i am after, the rowcount of the last INSERT/DELETE/
>> >> > UPDATE statement.
[quoted text clipped - 10 lines]
>
> Yeah, it isn't very convincing, but its the truth :-)
...which doesn't make it any better. So why use such a crappy "feature" in
the first place?

Signature
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany