Informix Error -9646: Result of a Boolean expression is not of Boolean type.
Cause and resolution
Result of a Boolean expression is not of Boolean type.
When a conditional expression, such as a WHERE clause or an IF clause, is evaluated in this statement, the result is not a Boolean value. All conditional expressions must evaluate to a Boolean value, so check that all conditional expressions evaluate correctly. If the expression does not, use appropriate casts to make it evaluate properly.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-9646 fires when a conditional expression (a WHERE clause or an IF clause) doesn't evaluate to a Boolean value — per the official guidance.
- A conditional expression whose result isn't Boolean, per the official guidance — the direct, only cause; all conditional expressions must evaluate to a Boolean value.
Solutions / Resolution
- Check that all conditional expressions evaluate correctly, per the official guidance.
- Use appropriate casts to make the expression evaluate to Boolean, per the official guidance, if it doesn't naturally.
Examples
A non-Boolean conditional expression
IF some_udf(col) THEN ... -- -9646 if some_udf() doesn't return BOOLEAN
Corrected
IF some_udf(col) = 't' THEN ...
Diagnostic Checks
- Check the conditional expression's actual return type, and add a cast or comparison to make it evaluate to Boolean.
Related Errors / Related Topics
- -9648 — "Invalid value specified for a Boolean type." A related Boolean-type error, on an invalid literal value rather than an expression's overall result type.
A conditional expression didn't evaluate to Boolean — cast or compare it so it does.