Informix Error -11104: Invalid datetime format
Cause and resolution
Invalid datetime format
This Informix ODBC error code is the same as SQLSTATE value 22007. The following functions can return this error code: SQLBulkOperations, SQLExecDirect, SQLExecute, SQLExtendedFetch, SQLFetch, SQLFetchScroll, SQLGetData, SQLPutData, and SQLSetPos.
For SQLBulkOperations, the Operation argument was SQL_ADD, and the assignment of a date or timestamp value to a column in the result set caused the year, month, or day field to be out of range.
For SQLExecDirect and SQLExecute, StatementText contained an SQL statement that contained a date, time, or timestamp structure as a bound parameter, and the parameter was, respectively, an invalid date, time, or timestamp.
For SQLFetch, SQLExtendedFetch, SQLGetData, and SQLFetchScroll, a character column in the result set was bound to a date, time, or timestamp C structure, and a value in the column was, respectively, an invalid date, time, or timestamp.
For SQLPutData, an input/output or output parameter was bound to a date, time, or timestamp C structure, and a value in the returned parameter was, respectively, an invalid date, time, or timestamp. (Function returns SQL_SUCCESS_WITH_INFO.)
For SQLSetPos, the argument Operation was SQL_UPDATE, and the assignment of a date or timestamp value to a column in the result set caused the year, month, or day field to be out of range. The argument Operation was SQL_REFRESH, and returning the date or timestamp value for one or more bound columns would have caused the year, month, or day field to be out of range.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-11104 fires when a date/timestamp value is out of range or malformed — per the official
guidance, this is the same as SQLSTATE value 22007, returnable by SQLBulkOperations,
SQLExecDirect, SQLExecute, SQLExtendedFetch, SQLFetch, SQLFetchScroll,
SQLGetData, SQLPutData, and SQLSetPos.
- For
SQLBulkOperationswithOperation=SQL_ADD: assigning a date/timestamp value whose year, month, or day field is out of range, per the official guidance — the first named case. - For
SQLExecDirect/SQLExecute: a bound date/time/timestamp structure parameter that was itself an invalid date, time, or timestamp, per the official guidance — the second named case. - For
SQLFetch/SQLExtendedFetch/SQLGetData/SQLFetchScroll: a character result column bound to a date/time/timestamp C structure, where the column's value was an invalid date, time, or timestamp, per the official guidance — the third named case. - For
SQLPutData: an input/output or output parameter bound to a date/time/timestamp C structure, where the returned value was invalid, per the official guidance — the fourth named case; the function returnsSQL_SUCCESS_WITH_INFO. - For
SQLSetPoswithOperation=SQL_UPDATE/SQL_REFRESH: assigning or returning a date/timestamp value whose year, month, or day field is out of range, per the official guidance — the fifth named case.
Solutions / Resolution
- Check every date/timestamp value's year, month, and day fields, per the official guidance's implication, and correct any out-of-range or malformed value.
- For
SQLExecDirect/SQLExecute/SQLPutData: correct the bound structure's date, time, or timestamp value before sending it, per the official guidance. - For
SQLFetch/SQLExtendedFetch/SQLGetData/SQLFetchScroll: correct the source column's stored value, or bind it to a wider/looser C type, per the official guidance.
Examples
N/A
No specific triggering statement is documented beyond an out-of-range or malformed date/timestamp value.
Diagnostic Checks
- Check the year, month, and day fields of every date/timestamp value involved, and confirm each is validly formed and in range.
Related Errors / Related Topics
- -11105 — "Interval field overflow" — a related datetime-value error, for interval fields rather than date/timestamp fields.
A date/timestamp value's year, month, or day field was out of range or malformed — check each field.