Informix Error -9049: A value entered as a command line parameter cannot be converted to the data type type.
Cause and resolution
A value entered as a command line parameter cannot be converted to the data type type.
A PARAMETER statement in the DEFINE section defines one of the values from the command line as having data type type. However, the value that is given on the command line cannot be converted to that type. Check the following points:
* If type is numeric, check that the parameter can be read as a number.
* If type is MONEY, the parameter should nevertheless not include a currency symbol.
* If type is CHARACTER or VARCHAR, check that the parameter is not longer than the length that is defined for the variable.
* If type is DATETIME, check that the parameter is correctly punctuated (refer to the information on DATETIME and INTERVAL data in the user guide).
* If type is DATE, check that the parameter is correctly punctuated as a date.
Correctly punctuated DATE, DATETIME and INTERVAL values contain characters that might have special meaning to the operating system. The problem might be that the parameter was correct but needed quotes around it to protect it.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-9049 fires when a value given on the command line can't be converted to the data type its PARAMETER statement declared — per the official guidance.
- A numeric type parameter that can't be read as a number, per the official guidance.
- A MONEY type parameter that includes a currency symbol, per the official guidance — MONEY parameters should not include one.
- A CHARACTER or VARCHAR type parameter longer than the variable's defined length, per the official guidance.
- A DATETIME type parameter that isn't correctly punctuated, per the official guidance.
- A DATE type parameter that isn't correctly punctuated as a date, per the official guidance.
Solutions / Resolution
- Check that a numeric parameter can be read as a number, per the official guidance.
- Omit any currency symbol from a MONEY parameter, per the official guidance.
- Check that a CHARACTER/VARCHAR parameter isn't longer than the defined length, per the official guidance.
- Check that a DATETIME parameter is correctly punctuated, per the official guidance.
- Check that a DATE parameter is correctly punctuated as a date, per the official guidance.
- Quote DATE/DATETIME/INTERVAL parameters on the command line, per the official guidance — correctly punctuated values contain characters that can have special meaning to the operating system, so a correct parameter may still need quotes to protect it from shell interpretation.
Examples
A MONEY parameter with a currency symbol
$ sacego myreport '$100.00' -- -9049: MONEY parameter must not include '$'
Corrected
$ sacego myreport '100.00'
Diagnostic Checks
- Check the DEFINE section's PARAMETER statement for the declared type, and check the corresponding command-line value against that type's conversion rules.
Related Errors / Related Topics
- -9050 — "The user variable name is of type type. The value entered is out of range or cannot be converted to that type." The same class of conversion error, for PROMPT-entered values rather than command-line parameters.
- -9051 — "The number of defined parameters in the ACE program does not equal the number of actual parameters passed to ACEGO on the command line." A related command-line-parameter error, on count rather than type conversion.
A command-line parameter couldn't be converted to its PARAMETER statement's declared type — check the value against that type's conversion rules.