Learn it on Mainframe Path. Do it with Mainframe KIT.Learn on Mainframe Path ▸
Mainframe KIT ● Nothing leaves this tab

-503

Column cannot be updated: not in the cursor's FOR UPDATE clauseNEGATIVE SQLCODE · CHECKED 2026-11-07
Checked against IBM documentation

A positioned UPDATE through a cursor named a column that the cursor's FOR UPDATE clause did not list, so no data was changed.

QUICK ANSWER

A positioned UPDATE through a cursor named a column that the cursor's FOR UPDATE clause did not list, so no data was changed.

LIKELY CAUSES, IN THE ORDER OF THIS ENTRY

  1. The UPDATE sets a column that was left out of FOR UPDATE OF in DECLARE CURSOR.
  2. The column list in FOR UPDATE OF was edited later without changing the UPDATE.
  3. Two cursors were mixed up, one with a shorter column list.
  4. An UPDATE statement was copied from another program with a different cursor.

CHECKED 7 Nov 2026 IBM: Db2 13 for z/OS Codes: -503

MOST LIKELY

The UPDATE sets a column that was left out of FOR UPDATE OF in DECLARE CURSOR.

FIRST CHECK

Compare the SET columns of the UPDATE with the FOR UPDATE OF list of the cursor.

TRY IT ▸

Site search

What it means

When a cursor is declared with a FOR UPDATE clause, only the columns named there can be changed by UPDATE ... WHERE CURRENT OF. The program tried to set a column outside that list, so Db2 refuses the statement and leaves the table untouched.

This is a mismatch between the cursor declaration and the later UPDATE, so the fix is in the program source.

Typical causes

  • The UPDATE sets a column that was left out of FOR UPDATE OF in DECLARE CURSOR.
  • The column list in FOR UPDATE OF was edited later without changing the UPDATE.
  • Two cursors were mixed up, one with a shorter column list.
  • An UPDATE statement was copied from another program with a different cursor.

How to fix it

  1. Compare the SET columns of the UPDATE with the FOR UPDATE OF list of the cursor.
  2. Add the missing column name to FOR UPDATE OF in the cursor declaration, or remove it from SET.
  3. Check that the UPDATE names the cursor you meant in WHERE CURRENT OF.
  4. Precompile and rerun.

Example

Illustrative only; names and values are invented.

SQLCODE = -503, SQLSTATE 42912
-- cursor: FOR UPDATE OF SALARY, but the UPDATE sets BONUS