Informix Error -1266: Intervals or Datetimes are incompatible for the operation.
Cause and resolution
Intervals or Datetimes are incompatible for the operation.
Some arithmetic combinations of DATETIME, INTERVAL, and numeric values are meaningless and are not allowed. Review the arithmetic expressions in this statement. Possibly one of them is using a DATETIME or INTERVAL column or variable by mistake. If not, see your SQL reference material for the valid use of these data types.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1266 fires when an arithmetic expression combines DATETIME, INTERVAL, and/or numeric values
in a way that isn't a permitted operation — per the official guidance, not every combination of
these types supports every arithmetic operator.
- An unsupported combination of
DATETIME/INTERVAL/numeric operands, per the official guidance — the direct, common cause. - A
DATETIME/INTERVALcolumn or variable used incorrectly in an expression, per the official guidance's own suggested review point.
Solutions / Resolution
- Review the arithmetic expressions in the statement for proper data type usage, per the official guidance.
- Verify
DATETIME/INTERVALcolumns/variables aren't being used incorrectly, per the official guidance. - Consult SQL reference documentation for valid operations with these data types, per the official guidance, since the valid-combination rules are type-pair-specific.
Examples
An unsupported combination
SELECT order_datetime * 2 FROM orders WHERE order_id = 1;
-- -1266: multiplying a DATETIME by a plain number isn't a supported operation
Diagnostic Checks
- Identify the specific
DATETIME/INTERVAL/numeric combination and operator involved, and check it against the documented valid operations for those types.
Related Errors / Related Topics
- -1265 — "Overflow occurred on a datetime or interval operation." A related
DATETIME/INTERVALarithmetic error, about a supported operation overflowing rather than an unsupported combination. - -1267 — "The result of a datetime computation is out of range." A related
DATETIMEarithmetic error, about the result being invalid rather than the operation itself being unsupported.
An unsupported combination of DATETIME/INTERVAL/numeric operands and operator — check the
expression against documented valid operations for these types.