8.1.7 getResultSet(long index, int count)
- Organization of this subsection
(1) Function
This method acquires a result set containing a portion of array elements of an array-type column.
(2) Format
public synchronized ResultSet getResultSet(long index,int count) throws SQLException
(3) Arguments
- long index
-
Specifies the ordinal number of the first array element to retrieve. Specify 1 to retrieve from the beginning of the array.
- int count
-
Specifies the number of array elements to be retrieved consecutively.
(4) Return value
A sequence of array elements, starting from the ordinal number specified in the argument index and up to the number specified in the argument count, is returned as a ResultSet object.
The relationship between the values specified for the arguments index and count and the ResultSet object returned is shown in the following table.
|
Specified value of index |
Specified value of count |
Specified value of index + specified value of count |
ResultSet object returned |
|---|---|---|---|
|
1 ≤ specified-index-value ≤ number-of-array-elements |
0 ≤ specified-count-value |
(specified-index-value + specified-count-value) - 1 ≤ number-of-array-elements |
A result set with a length equal to the specified count value |
|
(specified-index-value + specified-count-value) - 1 > number-of-array-elements |
A result set with a length equal to the number-of-array-elements - (specified-index-value - 1) |
||
|
specified-count-value < 0 |
-- |
Throwing an SQLException |
|
|
specified-index-value > number-of-array-elements |
-- |
-- |
Throwing an SQLException |
|
specified-index-value < 1 |
-- |
-- |
Throwing an SQLException |
- Legend:
-
--: Not applicable.
(5) Exceptions
The JDBC driver throws an SQLException in the following cases:
-
The ResultSet object that created this Array object is closed.
This scenario also includes cases where the ResultSet object was closed because the Statement object that created this ResultSet object was closed.
-
The Connection object used to create the Statement object has been closed.
-
The ResultSet object has become invalid due to transaction settlement.
-
The column value cannot be retrieved as an Array value.
-
The index argument is less than 1 or greater than the number of array elements.
-
The count argument is less than 0.
-
An error occurred in the JDBC driver.