Usage Restrictions v13

The following are restrictions on cursor variable usage.

  • Comparison operators cannot be used to test cursor variables for equality, inequality, null, or not null
  • Null cannot be assigned to a cursor variable
  • The value of a cursor variable cannot be stored in a database column
  • Static cursors and cursor variables are not interchangeable. For example, a static cursor cannot be used in an OPEN FOR statement.

In addition the following table shows the permitted parameter modes for a cursor variable used as a procedure or function parameter depending upon the operations on the cursor variable within the procedure or function.

OperationININ OUTOUT
OPENNoYesNo
FETCHYesYesNo
CLOSEYesYesNo

So for example, if a procedure performs all three operations, OPEN FOR, FETCH, and CLOSE on a cursor variable declared as the procedure’s formal parameter, then that parameter must be declared with IN OUT mode.