Informix Error -1270: Interval literal may not have embedded minus sign.
Cause and resolution
Interval literal may not have embedded minus sign.
You can use a minus sign as an arithmetic operator between an INTERVAL literal and other values, and you can use a minus sign as a prefix to an INTERVAL literal to indicate it is a negative quantity. However, you cannot embed a minus sign among the fields of the literal. If you did not intend to do this, inspect the statement for missing or misplaced punctuation.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1270 fires when a minus sign appears embedded within an INTERVAL literal's own fields — per
the official guidance, a minus sign is only valid as an arithmetic operator between an
INTERVAL literal and another value, or as a prefix indicating a negative INTERVAL — not
embedded inside the literal's fields.
- A minus sign placed between fields within the literal itself, per the official guidance — the direct, only cause, rather than as a leading negative-sign prefix or an arithmetic operator outside the literal.
Solutions / Resolution
- Review the SQL statement for missing or misplaced punctuation, per the official guidance — move the minus sign to a valid position (a prefix, or an arithmetic operator outside the literal).
Examples
An embedded minus sign
SELECT INTERVAL(1-2) DAY TO DAY FROM orders WHERE order_id = 1;
-- -1270: the minus sign is embedded within the literal's fields
Corrected — prefix negative
SELECT -INTERVAL(12) DAY TO DAY FROM orders WHERE order_id = 1;
Diagnostic Checks
- Check the literal for a minus sign positioned inside its fields, rather than as a leading prefix.
Related Errors / Related Topics
- -1262 — "Non-numeric character in datetime or interval." A related literal-formatting error, about invalid characters/delimiters more generally.
A minus sign is embedded within the INTERVAL literal's own fields — move it to a valid prefix
or operator position.