DB2 Error Code -511 – SQL0511N The FOR UPDATE clause is not allowed because the table specified by the cursor cannot be modified.

In this post, you’ll learn about the DB2 error -511-SQL0511N The FOR UPDATE clause is not allowed because the table specified by the cursor cannot be modified. and the reason why you are receiving the error message and how to fix it

How does this Error Message Looks like

-511 – SQL0511N The FOR UPDATE clause is not allowed because the table specified by the cursor cannot be modified.

Reason for the Error & Solution

A datastore transaction read was attempted on a table that is marked as read-only. Either read the data outside of a transaction, or use optimistic transactions.