PL/I · DB2 SQLCODE

SQLCODE -401: Operand Data Types Not Compatible

What does SQLCODE -401: Operand Data Types Not Compatible mean in PL/I?

A WHERE clause, arithmetic expression, or assignment in embedded SQL combines two operands whose types DB2 cannot reconcile. A common PL/I trap is a host variable declared with a stale type in DCLGEN (for example CHAR vs DECIMAL) after the underlying column's type changed.

SQLCODE -401: Operand Data Types Not CompatibleDB2 for z/OS · PL/I (embedded SQL)

Condition

A WHERE clause, arithmetic expression, or assignment in embedded SQL combines two operands whose types DB2 cannot reconcile. A common PL/I trap is a host variable declared with a stale type in DCLGEN (for example CHAR vs DECIMAL) after the underlying column's type changed.

Fix

Re-run DCLGEN against the current table and diff it against the copybook in the program to catch a stale host variable type, and add explicit casting in the SQL if comparing genuinely different types is intentional.

Related db2 sqlcode