SQLCODE -401
SQL0401 Comparison operands not compatible
- IBM message text
- Comparison operator &1 operands not compatible.
- SQLCODE
- -401
- SQLSTATE
- 42818
Most common cause
A comparison between types Db2 for i cannot compare. Numbers and characters, instead, do compare: the string is converted, and if it holds no number the error is a different one (-420).
Other causes
- A binary column (BINARY, VARBINARY, BLOB) compared with a non-binary one.
- A user-defined distinct type compared with its source type.
- An XML or DataLink column in a comparison.
How to fix it
Make the operands compatible with an explicit CAST, or with the distinct type's function. If the table is a view, check the types in its definition too.
Related errors
Text and codes from IBM documentation for 7.6. Checked on .