To update a particular element in a collection, declare
an update cursor for the collection host variable.
About this task
An update cursor for a collection variable is a
select cursor that was declared with the FOR UPDATE keywords. The
update cursor allows you to sequentially scroll through the elements
of the collection and update the current element with the UPDATE...WHERE
CURRENT OF statement.
To update elements, follow these steps:
Procedure
Create a client collection variable in your program.
Close the update cursor with the CLOSE statement, and if
you no longer need the cursor, free it with the FREE statement.
Results
The application must position the update cursor on the
element to be updated and then use UPDATE...WHERE CURRENT OF to update
this value.
The program
in the following figure uses an update cursor to update an element
in the collection variable, a_set, and then to update
the set_col column of the tab_set table (see Sample tables with collection columns).