logo  
Google
 

DB2 SQL-Error: -222

SQLState: 24510

Short Description: AN UPDATE OR DELETE OPERATION WAS ATTEMPTED AGAINST A HOLE USING CURSOR

DB2 could not process a positioned update or delete with cursor cursor-name that is defined as SENSITIVE STATIC. The application program attempted to execute an UPDATE or DELETE WHERE CURRENT OF cursor statement at a time when the specified cursor was positioned on a row of the object table that is a hole. Each row that the cursor is positioned on, that is to be updated or deleted must not be a hole: v An update hole occurs when the corresponding row of the underlying table has been updated, and the updated row no longer satisfies the search condition that is specified in the SELECT statement of the cursor. v A delete hole occurs when the corresponding row of the underlying table has been deleted. This error might be issued if the following situations occur: v If the cursor is not a rowset cursor, then the row corresponding to the current cursor position is either an update hole, or a delete hole. DB2 detects these holes when DB2 tries to update or delete the current row of the result table for the cursor cursor-name, and cannot locate the corresponding row of the underlying table. v If the cursor is a rowset cursor, then a row corresponding to a row of the current rowset cursor position is either an update hole or a delete hole. DB2 detects these holes when DB2 tries to update or delete the current row of the result table for cursor cursor-name, and cannot locate the corresponding row or rows of the underlying table.System action: The statement cannot be processed. No data was updated or deleted, and the cursor position is unchanged. Programmer response: Correct the logic of the application program to ensure that the cursor is correctly positioned on the intended row or rows of the object table, and that the intended rows are not holes, before the DELETE or UPDATE statement is executed. v If the cursor is not a rowset cursor, then issue a FETCH statement to position the cursor on a row that is not a hole. Then, reissue the UPDATE or DELETE statement. v If the cursor is a rowset cursor, and is also the positioned UPDATE or DELETE statement intended to affect a single row corresponding to the rows of the current rowset cursor position (this means for a FOR ROW n of ROWSET clause was specified), then change the UPDATE or DELETE statement to process the rows that are not holes, one at a time. v If the cursor is a rowset cursor, and is also the positioned UPDATE or DELETE statement intended to affect all rows corresponding to the rows of the current rowset cursor position (this means for a FOR ROW n of ROWSET clause was not specified), then change the UPDATE or DELETE statement to process the rows that are not holes, one at a time. Add a FOR ROW n of ROWSET clause to the UPDATE or DELETE statement to indicate which row of the cursor is to be updated or deleted.

 <-  BACK TO INDEX