PL/I · DB2 SQLCODE

SQLCODE -305: Null Value with No Indicator Variable

What does SQLCODE -305: Null Value with No Indicator Variable mean in PL/I?

A FETCH or SELECT INTO in the PL/I program retrieved a NULL column value into a host variable that has no paired indicator variable declared in the BEGIN DECLARE SECTION, so DB2 has nowhere to signal the null back to the program.

SQLCODE -305: Null Value with No Indicator VariableDB2 for z/OS · PL/I (embedded SQL)

Condition

A FETCH or SELECT INTO in the PL/I program retrieved a NULL column value into a host variable that has no paired indicator variable declared in the BEGIN DECLARE SECTION, so DB2 has nowhere to signal the null back to the program.

Fix

Add an indicator variable (a FIXED BIN(15) host variable) for every nullable column in the SELECT or FETCH list, and check it after the fetch instead of trusting the data host variable when the indicator is negative.

Related db2 sqlcode