|
Result set and cursor mechanisms
A result set maintains a cursor, which points to its current row of
data. It can be used to step through and process the rows one by one.
In Derby, any
SELECT statement generates a cursor which can be controlled by a
java.sql.ResultSet object.
Derby does not
support SQL-92's DECLARE CURSOR language construct to create cursors,
however Derby
supports positioned deletes and positioned updates of updatable
cursors.
- Simple non-updatable result sets
This example is an excerpt from a sample JDBC application that generates a result set with a simple SELECT statement and then processes the rows.
- Updatable result sets
Updatable result sets in Derby can be updated by using result set update methods (updateRow(),deleteRow() and insertRow()), or by using positioned update or delete queries.
- Result sets and auto-commit
Except for the result sets associated with holdable cursors, issuing a commit will cause all result sets on your connection to be closed.
- Scrollable result sets
JDBC provides two types of result sets that allow you to scroll in either direction or to move the cursor to a particular row. Derby supports one of these types: scrollable insensitive result sets (ResultSet.TYPE_SCROLL_INSENSITIVE).
- Holdable result sets
The holdable result set feature permits an application to keep result sets open after implicit or explicit commits. By default, the cursor controlled by the result set is held open after a commit.
|