Hitachi

Hitachi Advanced Database Application Development Guide


8.3.9 executeBatch()

Organization of this subsection

(1) Function

This method executes the SQL statements registered in a batch and returns the number of updated rows as int data in an array.

The method clears all the SQL statements registered in the batch after executing all of them. If an error occurs during processing, the method still clears all the SQL statements registered in the batch.

If the number of updated rows might exceed Integer.MAX_VALUE, use the executeLargeBatch method instead of the executeBatch method. If you use the executeBatch method, it will return 0 if the number of updated rows exceeds Integer.MAX_VALUE.

(2) Format

public synchronized int[] executeBatch() throws SQLException

(3) Arguments

None.

(4) Return value

This method returns the number of updated rows for each SQL statement that was executed, as int data in an array. The elements of the array are in the order the SQL statements were registered into the batch. If no SQL statements are registered in the batch, or if the first SQL statement in the batch resulted in an error, the method returns an array containing no elements.

(5) Exceptions

The JDBC driver throws an SQLException in the following cases:

The method throws a BatchUpdateException (subclass of SQLException) in the following cases: