Closing a row cursor

Close a row cursor when it finishes processing rows if you want to free the resources or if you want to use the cursor again. Otherwise, you can let DB2® automatically close the cursor when the current transaction terminates or when your program terminates.

About this task

To free the resources that are held by the cursor, close the cursor explicitly by issuing the CLOSE statement.

If you want to use the rowset cursor again, reopen it.

Procedure

To close a row cursor:

Issue a CLOSE statement. An example of a CLOSE statement looks like this:
EXEC SQL
  CLOSE C1
END-EXEC.