Informix Error -1317: A numeric conversion error has occurred due to incompatibility between a calling program and its function parameters or between a variable and its assigned expression.
Cause and resolution
A numeric conversion error has occurred due to incompatibility between a calling program and its function parameters or between a variable and its assigned expression.
4GL converts between one data type and another automatically whenever it can do so without losing information. In the current statement, it could not do so. Look first for function calls, and inspect the values that are passed as parameters. Check that the values that are passed agree in type with the parameters as they are defined in the function bodies. (An example of such an error would be calling a function fun("X") when within the function its parameter was defined as an integer.) If the statement is a LET statement, check that the value that is computed on the right can be accommodated in the variable that is named on the left.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1317 fires when 4GL can't automatically convert between data types without losing information — per the official guidance, this covers both function calls whose arguments don't match the declared parameter types, and assignment statements whose computed value doesn't fit the target variable.
- A function call with an argument that doesn't match the declared parameter type, per the official guidance — the direct, common cause.
- An assignment whose computed value can't fit into the target variable, per the official guidance — the other direct, common cause.
Solutions / Resolution
- Verify function arguments align with their defined parameter types, per the official guidance.
- Verify assigned values are compatible with their target variables, per the official guidance.
Examples
An argument type mismatch
FUNCTION add_days(p_date DATE, p_days INTEGER)
RETURN p_date + p_days;
END FUNCTION
CALL add_days("not a date", 5)
-- -1317: "not a date" can't be converted to DATE without losing information
Diagnostic Checks
- Check every function call's arguments against the function's declared parameter types.
- Check every assignment's source value against the target variable's declared type.
Related Errors / Related Topics
- -1318 — "A parameter count mismatch has occurred between the calling function and the called function." A related function-call error, about argument count rather than type compatibility.
- -1320 — "A function has not returned the correct number of values expected by the calling function." A related function-call error, about return-value count.
A function argument or assignment value doesn't convert cleanly to its target type — check argument types and assignment compatibility.