I have a db2 database and I want to do the following via a shell script in unix:
(1) run a query
SELECT MEMBERID FROM MEMBERS WHERE AGE<16
(2) then for each record returned by this query, I want to update it in this way:
UPDATE MEMBERS SET ADULT='N' WHERE MEMBERID=<the member id returned above>
I already know how to connect to db2 and run the SELECT and get the value of MEMBERID for processing. However, I can't figure out how loop through a resultset of multiple records returned by the query. Can anyone help me how to go about doing that? How does one loop through a db2 resultset in unix so that this can be done?