8.5.2 absolute(int row)
- Organization of this subsection
(1) Function
This method moves the cursor to a specified row in the ResultSet object.
(2) Format
public synchronized boolean absolute(int row) throws SQLException
(3) Arguments
- int row
-
Specifies the number of the row to which the cursor is to be moved. A positive number indicates that the row numbers in the result set are to be counted from the beginning, and a negative number indicates that the row numbers are to be counted from the end of the result set.
(4) Return value
If the cursor position resulting from the absolute method call is before the first row or after the last row, the method returns false; otherwise, the method returns true.
The following table shows the destination of the cursor and the return value when the absolute method is executed.
Number of rows in result set# |
Specified row value |
Destination of cursor |
Return value |
---|---|---|---|
0 |
Non-zero value |
Remains before the first row |
false |
n |
n < row |
After the last row |
false |
1 ≤ row ≤ n |
row |
true |
|
-n ≤ row ≤ -1 |
(n + 1) + row |
true |
|
row < -n |
Before the first row |
false |
- #
-
If the actual number of rows is greater than the setMaxRows value, the setMaxRows value takes effect.
If the actual number of rows is greater than the setLargeMaxRows value, the setLargeMaxRows value takes effect.
(5) Exceptions
The JDBC driver throws an SQLException in the following cases:
-
This ResultSet object is closed.
This includes the case where the ResultSet object was closed because the Statement object that created this ResultSet object was closed.
-
The Connection used to create the Statement object that created this ResultSet object has been closed.
-
The type of this ResultSet object is ResultSet.TYPE_FORWARD_ONLY.
-
A value of 0 was specified for row.
-
The ResultSet object has become invalid due to transaction settlement.
-
A database access error occurs.