← All errors

SQLCODE -305

SQL0305 Indicator variable required

IBM message text
Indicator variable required.
SQLCODE
-305
SQLSTATE
22002

Most common cause

The query returns NULL and the variable has no indicator. It often happens with outer joins, or with MAX and SUM when no row matches.

Other causes

  • A nullable column added to a table that had none before.

How to fix it

Use COALESCE in the SELECT, or declare an indicator variable (INTO :value :nullInd) and test it.

Related errors

Text and codes from IBM documentation for 7.6. Checked on .