-510   THE TABLE DESIGNATED BY THE CURSOR OF THE UPDATE OR DELETE STATEMENT CANNOT BE MODIFIED

Explanation

The application program attempted to execute an UPDATE or DELETE WHERE CURRENT OF cursor statement against a table or view that cannot be updated or deleted. This error can be returned for the following reasons:
  • A delete was performed from a read-only view or for an update in which the cursor was not defined with the FOR UPDATE clause.
  • A target table exists at a remote location and DB2® has employed block fetching because you explicitly declared the cursor FOR FETCH ONLY, or because the application is bound CURRENTDATA( NO) and the cursor is ambiguous.
  • DB2 has employed parallelism to execute the SELECT statement associated with the cursor named in a DELETE WHERE CURRENT OF cursor statement, or a DELETE WHERE CURRENT OF is issued against a row which DB2 cannot guarantee to have not been modified by another application since the time the cursor was positioned upon it (in accordance with ISO(CS)) semantics for an ambiguous cursor in an application bound CURRENTDATA(NO)).
  • The cursor references a view on which an INSTEAD OF UPDATE trigger is defined, even if the view is an updatable view.

System action

The statement cannot be processed. No data was updated or deleted in the object table or view.

Programmer response

The requested UPDATE or DELETE cannot be performed.

For a remote table, modify the DECLARE CURSOR and then rebind the PLAN.

For a cursor that uses parallelism, disable parallelism for the query by using the DEGREE(1) BIND option for static SQL or by setting the CURRENT DEGREE special register to '1' for dynamic SQL.

For an ambiguous cursor in an application bound CURRENTDATA(NO), either make the cursor unambiguous (declare it FOR UPDATE OF), or rebind the application CURRENTDATA(YES).

For a view with INSTEAD OF triggers, drop those triggers.

SQLSTATE

42828