In this blog post, let’s learn about the error message “4117 The cursor query expression might be nonupdatable.” when working with HPE NonStop SQL/MX, the reason for the error and the solution to fix this error message.
Error Message
4117 The cursor query expression might be nonupdatable.
Reason for the Error
You specified a join or a nonupdatable query in an updatable cursor query (that is, one with an optional FOR UPDATE OF clause). That cursor’s select list did not select the target column of the update.
Solution
An updatable cursor query should specify the target update column in the select list of the query. Use the FOR UPDATE OF clause only if the cursor query is updatable.
This example of a nonupdatable cursor join query does not select the target of the update and receives an error:
>>SELECT A.PROD_CODE FROM EXPRODPARAMS A, MSRATES B
+>WHERE CASE WHEN B.UPDATE_FLAG IS NULL THEN ‘N’ ELSE B.UPDATE_FLAG END=’N’
+>AND A.ACC_TYPE=B.ACC_TYPE AND A.PROD_CODE=B.PROD_CODE
+>FOR UPDATE OF UPDATE_FLAG ;
*** ERROR[4001] Column UPDATE_FLAG is not found. Tables in scope: A. Default schema: CAT.SCH.
*** ERROR[4117] The cursor query expression may be nonupdatable.
*** ERROR[8822] Unable to prepare the statement