My Oracle Support Banner

JDBC BatchUpdateException.getUpdateCounts() Incorrect When PK Violation Against Partitioned Table (Doc ID 1462943.1)

Last updated on AUGUST 30, 2023

Applies to:

JDBC - Version and later
Information in this document applies to any platform.


When a set of batched prepared statement inserts to a partitioned table fails due to a primary key constraint violation, the JDBC BatchUpdateException.getUpdateCounts() method returns an array of -2 (java.sql.Statement.SUCCESS_NO_INFO) status counts. Since none of the batched inserts were successfully added to the table, getUpdateCounts should return -3 (Statement.EXECUTE_FAILED) instead, as described as expected on page 23-13 of the Oracle Database JDBC Developer's Guide and Reference.

Oracle® Database JDBC Developer's Guide
11g Release 2 (11.2)

23 Performance Extensions
Update Batching

This problem occurs with Oracle JDBC driver using standard JDBC prepared statement update batching using a partitioned table.
It is observed with both and database server versions.
The JDBC driver works correctly (returns -3 update counts), as does the JDBC driver when using a non-partitioned table.
The issue does not occur when using JDBC OCI. The problem occurs only with JDBC Thin 11g and when inserting to a partitioned table.


 Upgrade of JDBC driver from to


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.