Informix Error -688
-688 Variable variable-name must be declared CHAR or VARCHAR.
You declared the variable as a data type other than CHAR or VARCHAR. Correct the declaration, and try again.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-688 fires when a variable used in a context requiring a character type is declared as something
else — per the official guidance, the fix is simply to correct the declaration to CHAR/
VARCHAR.
- A variable declared as a non-character type (
INTEGER,DATE, etc.) used somewhere that specifically requiresCHAR/VARCHAR— for example, as the target ofSET DEBUG FILE TO(per -649) or another character-specific context. - A variable reused from elsewhere in the routine (declared for a different, non-character purpose) repurposed for a character-specific use without redeclaring it.
Solutions / Resolution
- Correct the declaration to
CHAR/VARCHAR, per the official guidance, matching the width the specific context needs. - If the variable genuinely needs to hold both a non-character value and a character
representation of it, declare a separate
CHAR/VARCHARvariable for the character-specific use rather than trying to reuse the original.
Examples
The disallowed declaration
DEFINE v_debug_path INT;
SET DEBUG FILE TO v_debug_path;
-- -688: v_debug_path must be CHAR or VARCHAR
Corrected
DEFINE v_debug_path VARCHAR(200);
LET v_debug_path = '/path/to/debug/directory/routine_trace.out';
SET DEBUG FILE TO v_debug_path;
Diagnostic Checks
- Identify the specific
variable-namenamed in the error and the context it's used in, then correct its declaration toCHAR/VARCHARwith an appropriate width.
Related Errors / Related Topics
- -666 — "Variable variable-name must be declared INTEGER or SMALLINT." The mirror-image
type requirement, for a different context (a ranged
FORloop variable) that needs a numeric type instead.
A type-mismatch error — correct the declaration to CHAR/VARCHAR, matching the specific
character-requiring context that triggered it.