Informix Error -4401: A concatenation operation has created a string too long to fit in the destination string variable.
Cause and resolution
A concatenation operation has created a string too long to fit in the destination string variable.
This statement concatenates two or more character strings and stores the result in another variable of type CHAR or VARCHAR. However, the result of concatenation was longer than the receiving variable. If the excess length is due to trailing spaces, you can use the CLIPPED function to prevent them from being included in the combined result. Otherwise you will have to define the length of the receiving variable as at least the sum of the lengths of the input variables.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4401 fires when a concatenation's result is longer than the receiving CHAR/VARCHAR
variable — per the official guidance, if the excess length comes from trailing spaces, the
CLIPPED function can trim them.
- A concatenation result longer than the receiving variable's declared length, per the official guidance — the direct, only cause.
Solutions / Resolution
- Use
CLIPPEDon the input strings if trailing spaces are the cause of the excess length, per the official guidance. - Otherwise, define the receiving variable's length as at least the sum of the input variables' lengths, per the official guidance.
Examples
A concatenation exceeding the destination length
DEFINE first CHAR(15), last CHAR(15), full CHAR(20)
LET full = first, last
-- -4401: 15+15=30 exceeds full's declared length of 20
Corrected
LET full = first CLIPPED, " ", last CLIPPED
Diagnostic Checks
- Check the receiving variable's declared length against the combined length of the
concatenated inputs, using
CLIPPEDto trim trailing spaces, or widening the receiving variable.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -4401 in this set yet.
A concatenation's result is longer than the receiving variable — use CLIPPED to trim
trailing spaces, or widen the receiving variable.