A programmer makes a cursor known to the DBMS by using a Once an application has processed all available rows or the fetch operation is to be positioned on a non-existing row (compare scrollable cursors below), the DBMS returns a SQLSTATE '02000' (usually accompanied by an SQLCODE 100) to indicate the end of the result set.The final step involves closing the cursor using the After closing a cursor, a program can open it again, which implies that the DBMS re-evaluates the same query or a different query and builds a new result set.
A cursor can be SENSITIVE or INSENSITIVE to such data modifications.
A sensitive cursor picks up data modifications affecting the result set of the cursor, and an insensitive cursor does not.
One has to pay attention when using holdable cursors, however. Thus, once a transaction has been ended and committed, a subsequent transaction (running in a different application) could inherit existing holdable cursors.
Therefore, an application developer has to be aware of that situation. The following information may vary depending on the specific database system.
This is done because JDBC also activates auto-commit per default.
Cursors can not only be used to fetch data from the DBMS into an application but also to identify a row in a table to be updated or deleted.Cursors enable manipulation of whole result sets at once.In this scenario, a cursor enables the rows in a result set to be processed sequentially.The SQL:2003 standard defines positioned update and positioned delete SQL statements for that purpose.Such statements do not use a regular WHERE clause with predicates. The cursor must be opened and already positioned on a row by means of The cursor must operate on an updatable result set in order to successfully execute a positioned update or delete statement.In SQL procedures, a cursor makes it possible to define a result set (a set of data rows) and perform complex logic on a row by row basis.