Informix Error -1263
Cause and resolution
A field in a datetime or interval is out of range, incorrect, or missing.
Inspect the DATE, DATETIME, and INTERVAL literals in this statement; at least one of them contains at least one incorrect field or is missing at least one field.
In a DATE or DATETIME literal, the year might be zero, the month might be other than 1 to 12, or the day might be other than 1 to 31 or inappropriate for the month. Also in a DATETIME literal, the hour might be other than 0 to 23, the minute or second might be other than 0 to 59, or the fraction might have too many digits for the specified precision.
In an INTERVAL literal, the constraints are the same except that the first field is a count and can have as many digits as the qualifier specifies.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1263 fires when a field within a DATE/DATETIME/INTERVAL literal is out of range, incorrect,
or entirely missing — per the official guidance, for DATE/DATETIME: year can't be zero, month
must be 1-12, day must be 1-31 (valid for its month), hour must be 0-23, minute/second must be
0-59; for INTERVAL, the same field constraints apply except the first field (count) may have as
many digits as its qualifier specifies, and any fraction can't exceed the specified precision.
- A field value outside its valid range (per the official guidance's specific bounds for each field) — the direct, common cause.
- A required field missing from the literal entirely, per the official guidance's other named case.
- An
INTERVALfraction exceeding the qualifier's specified precision, per the official guidance'sINTERVAL-specific note.
Solutions / Resolution
- Check each field's value against its documented valid range, per the official guidance, and correct or supply the field as needed.
Examples
A zero year
SELECT DATETIME(0000-01-01) YEAR TO DAY FROM orders WHERE order_id = 1;
-- -1263: year cannot be zero
Corrected
SELECT DATETIME(2024-01-01) YEAR TO DAY FROM orders WHERE order_id = 1;
Diagnostic Checks
- Check every field in the literal against its documented valid range, and confirm no required field is missing.
Related Errors / Related Topics
- -1204 — "Invalid year in date." A related field-validity error, specific to the year
component of a
DATEliteral. - -1205 — "Invalid month in date." A related field-validity error, specific to the month.
- -1206 — "Invalid day in date." A related field-validity error, specific to the day.
- -1261 — "Too many digits in the first field of datetime or interval." A related literal- formatting error, about digit count rather than field value.
- -1262 — "Non-numeric character in datetime or interval." A related literal-formatting error, about invalid characters.
- -1264 — "Extra characters at the end of a datetime or interval." A related literal- formatting error, about trailing characters.
A field in the DATE/DATETIME/INTERVAL literal is out of range, incorrect, or missing —
check each field against its documented valid range.