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

-303

Data types not compatible for assignmentNEGATIVE SQLCODE · CHECKED 2026-11-14
Checked against IBM documentation

A value could not be assigned to an output variable because the variable's data type is not compatible with the source value's type.

QUICK ANSWER

A value could not be assigned to an output variable because the variable's data type is not compatible with the source value's type.

LIKELY CAUSES, IN THE ORDER OF THIS ENTRY

  1. The target variable's type is incompatible with the selected column or value.
  2. A datetime value is fetched into a variable that is not a character string of the correct length.
  3. The table definition changed and no longer matches the program's variables.

CHECKED 14 Nov 2026 IBM: Db2 13 for z/OS: SQLCODE -303 (Db2 for z/OS 13.0.0)

TRY IT: RECORD DECODER ▸

MOST LIKELY

The target variable's type is incompatible with the selected column or value.

FIRST CHECK

Use the position number to find the variable.

TRY IT ▸

Record decoder

What it means

This occurs for CALL, FETCH, SELECT, VALUES INTO or SET assignment statements. The message gives the position number of the variable. SQLSTATE is 42806.

Compatible pairs include numeric with numeric or character, character with character, row ID with row ID, and binary with binary. For datetime values the target must be a character variable of the right length.

Typical causes

  • The target variable's type is incompatible with the selected column or value.
  • A datetime value is fetched into a variable that is not a character string of the correct length.
  • The table definition changed and no longer matches the program's variables.

How to fix it

  1. Use the position number to find the variable.
  2. Verify that table definitions are current.
  3. Verify that the target variable has the correct data type.