In this example, the cursor declaration used in Example 2 is used. Here, data is fetched by the cursor
using the number of CUSTOMERs as the first sort key. The data is sorted in descending order. The
totals of STOCKQTY and ORDERQTY are used as the second sort key, and the data is sorted in
ascending order.
[Figure: Example of specifying column numbers in sort specification]
Updatable cursors and read-only cursors
Two types of cursors are available: updatable cursor and read-only cursors. Only updatable cursors can be used in
UPDATE statements and DELETE statements. Both updatable cursors and read-only cursors can be used in FETCH
statements. The cursor declaration determines if a cursor is updatable or read-only.
The following shows cursor declaration conditions for read-only cursors. SCM is used as the schema name for tables
TBL1 and TBL2 in this example.
48