The JDBC standard states that the executeUpdate method
returns a row count or 0. However, if the executeUpdate method is
executed against a DB2® for z/OS® server, it can return a value
of -1.
For
executeUpdate statements against a DB2 for z/OS server, the value that is returned depends
on the type of SQL statement that is being executed:
- For an SQL statement that can have an update count, such as an
INSERT, UPDATE, DELETE, or MERGE statement, the returned value is
the number of affected rows. It can be:
- A positive number, if a positive number of rows are affected by
the operation, and the operation is not a mass delete on a segmented
table space.
- 0, if no rows are affected by the operation.
- -1, if the operation is a mass delete on a segmented table space.
- For an SQL CALL statement, a value of -1 is returned, because
the data source cannot determine the number of affected rows. Calls
to getUpdateCount or getMoreResults for
a CALL statement also return -1.
- For any other SQL statement, a value of -1 is returned.