8.5.4 beforeFirst()
- Organization of this subsection
(1) Function
This method moves the cursor to the location immediately preceding the first row in the ResultSet object. The following table shows the location to which the cursor is moved when this method is executed.
Number of rows in result set# |
Current cursor position |
Destination of cursor |
---|---|---|
0 |
Before the first row |
Remains before the first row. |
n |
Before the first row |
Remains before the first row. |
1 ≤ current row ≤ n |
Before the first row |
|
After the last row |
Before the first row |
- #
-
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.
(2) Format
public synchronized void beforeFirst() throws SQLException
(3) Arguments
None.
(4) Return value
None.
(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.
-
The ResultSet object has become invalid due to transaction settlement.
-
A database access error occurs.