8.1.3 getArray(long index, int count)
- Organization of this subsection
(1) Function
This method acquires a portion of array elements of an array-type column as an Object array.
(2) Format
public synchronized Object getArray(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
Among the array elements stored in the Array object, a maximum of the number of consecutive array elements specified in the argument count, starting from the sequence number specified in the argument index, is returned as an Object array.
For the data type of the returned array element in HADB, refer to Table 8‒2: HADB data types of returned array elements.
The relationship between the values specified for the arguments index and count and the returned array is shown in the following table.
|
Specified value of index |
Specified value of count |
Specified value of index + specified value of count |
Returned array |
|---|---|---|---|
|
1 ≤ specified-index-value ≤ number-of-array-elements |
0 ≤ specified-count-value |
(specified-index-value + specified-count-value) - 1 ≤ number-of-array-elements |
An array with a length equal to the specified-count-value |
|
(specified-index-value + specified-count-value) - 1 > number-of-array-elements |
An array 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.