Informix Error -1262: Non-numeric character in datetime or interval.
Cause and resolution
Non-numeric character in datetime or interval.
The form of a DATETIME or INTERVAL literal is very limited. One can contain only decimal digits and the allowed delimiters: the hyphen between year, month, and day numbers; the space between day and hour; the colon between hour, minute, and second; and the decimal point between second and fraction. Any other characters, or these characters in the wrong order, produce an error.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1262 fires when a DATETIME/INTERVAL literal contains a character other than a decimal
digit or one of the specific allowed delimiters — per the official guidance, the only permitted
delimiters are a hyphen (between year/month/day), a space (between day and hour), a colon
(between hour/minute/second), and a decimal point (between second and fraction).
- A character in the literal that's neither a digit nor one of the four allowed delimiters, per the official guidance — the direct, common cause.
- A correct character used as the wrong delimiter in the wrong position (e.g. a colon where a hyphen belongs), per the official guidance's framing — the delimiters are positionally specific.
Solutions / Resolution
- Use only decimal digits and the specific allowed delimiters, per the official guidance — hyphen (year-month-day), space (day-hour), colon (hour:minute:second), decimal point (second.fraction).
Examples
An invalid delimiter
SELECT DATETIME(2024/01/15) YEAR TO DAY FROM orders WHERE order_id = 1;
-- -1262: '/' is not an allowed delimiter; year/month/day need hyphens
Corrected
SELECT DATETIME(2024-01-15) YEAR TO DAY FROM orders WHERE order_id = 1;
Diagnostic Checks
- Check every character in the literal against the allowed set: digits, and the four positionally-specific delimiters.
Related Errors / Related Topics
- -1261 — "Too many digits in the first field of datetime or interval." A related literal- formatting error, about digit count rather than character validity.
- -1263 — "A field in a datetime or interval is out of range, incorrect, or missing." A related literal-validity error, about a field's value rather than its characters.
- -1264 — "Extra characters at the end of a datetime or interval." A related literal- formatting error, about trailing characters specifically.
An invalid character (not a digit or an allowed, correctly-positioned delimiter) appears in the literal — correct the formatting.