Updating a row in db2
As said earlier there are no changes in declare, open & close statement syntax. Ex: Here we can specify either WITH ROW-SET POSITIONING or WITHOUT ROW-SET POSITIONING . 2) Open the cursor , it is same as normal cursor open statement.
3) Fetch the cursor with row-set option Here there are multiple options while fetching Fetch FIRST-ROWSET – Fetches first 10 rows Fetch NEXT-ROWSET – fetches next 10 rows We can also have the PRIOR-ROWSET, CURRENT-ROWSET, LAST-ROWSET & ROWSET STARTING AT options.
When processing a CURSOR, DB2 SQL give option to update or delete data in base table based on current position of CURSOR in result table.If id and name are not unique then it may update duplicate records which are not processed yet.Like in this case (id = 1 and name = SUMIT) is not unique so when 1st record of result table is processed it will also update 3rd record without processing it.Multi row Fetch Overview in COBOl Db2 program WITH EXAMPLE: Cobol Db2 multi row fetch concept will be used to retrieve multiple rows with a single fetch statement as opposed with a normal cursor which fetches only single record at a time.The multi-row fetch capability was introduced to DB2 z/OS in Version 8.