RPG (IBM i / AS/400) · DB2 SQLCODE

SQLCODE -301 - Host Variable Data Type Not Compatible

What does SQLCODE -301 - Host Variable Data Type Not Compatible mean in RPG (IBM i / AS/400)?

A static SQL statement used an input host variable whose RPG data type can't be implicitly converted to the type SQL needs at that position - for example a data structure or pointer used where a scalar numeric or character host variable is expected.

SQLCODE -301 - Host Variable Data Type Not CompatibleDB2 for i · SQLRPGLE

Condition

A static SQL statement used an input host variable whose RPG data type can't be implicitly converted to the type SQL needs at that position - for example a data structure or pointer used where a scalar numeric or character host variable is expected.

Fix

Declare host variables with SQL-compatible RPG types (packed or zoned numeric, character, or the SQL date/time types) and avoid passing complex data structures directly as scalar host variables.

Related db2 sqlcode