SQL - SQLSTATE 22002

By kimot, 27 December, 2022

If sql FETCH gives back SQLSTATE 22002 "A null value, or the absence of an indicator parameter was detected; for example, the null value cannot be assigned to a variable, because no indicator variable is specified."
Reason may be, that some column in SQL query contain null value.

Nulll values

You can filter null field with "IFNULL" sql function and set some value into this field.

SELECT Type, Order, ASP, Entity, IFNULL(Command,'N/A') AS Command, Status FROM MONASPUSGC
WHERE TYPE = '*NWSSTG'

Null