Informix Error -4354: Aggregate functions cannot be performed with TEXT or BYTE variables.
Cause and resolution
Aggregate functions cannot be performed with TEXT or BYTE variables.
This statement applies an aggregate function such as SUM to a variable that is defined as BYTE or TEXT. Such variables are not in the domain of the aggregate functions. Review the use of functions in the statement, and make sure that they are applied to the variables you intended.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4354 fires when an aggregate function such as SUM is applied to a TEXT/BYTE-typed
variable — per the official guidance, such variables aren't in the domain of aggregate
functions.
- An aggregate function applied to a
TEXT/BYTEvariable, per the official guidance — the direct, only cause.
Solutions / Resolution
- Review the statement and confirm the aggregate is applied to the variable actually
intended, per the official guidance — a numeric variable, not a
TEXT/BYTEone.
Examples
An aggregate applied to a TEXT variable
REPORT myreport(rec)
...
PRINT SUM(rec.notes)
-- -4354: rec.notes is TEXT, not aggregatable
Corrected
PRINT SUM(rec.total)
Diagnostic Checks
- Check the data type of every variable passed to an aggregate function, and confirm
it's not
TEXT/BYTE.
Related Errors / Related Topics
- -4353 — "The type of this ORDER BY or GROUP item specified for the report is not valid
for sorting." A closely related restriction on
TEXT/BYTEtypes, about ordering/grouping rather than aggregate functions.
An aggregate function is applied to a TEXT/BYTE variable, which isn't supported — apply it
to a numeric variable instead.