Informix Error -4349: The PERCENT and COUNT report aggregates cannot be used with an expression.
Cause and resolution
The PERCENT and COUNT report aggregates cannot be used with an expression.
These aggregate functions simply count entire rows, without regard for the contents of the rows. COUNT returns a count of the rows, and PERCENT returns the count of rows as a percentage of the entire table. The only permitted parameters of these functions '*' mean "the entire row." They cannot be applied to specific columns or to expressions that involve specific columns.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4349 fires when PERCENT/COUNT is applied to a specific column or expression — per the
official guidance, these aggregates count entire rows regardless of content; COUNT returns
the row count and PERCENT returns it as a percentage of the whole table, and the only
permitted parameter is * ("the entire row").
PERCENT/COUNTapplied to a specific column or expression instead of*, per the official guidance — the direct, only cause.
Solutions / Resolution
- Use
*as the parameter forCOUNT/PERCENTinstead of a column or expression.
Examples
COUNT applied to a specific column in a report aggregate
REPORT myreport(rec)
...
AFTER GROUP OF rec.customer_id
PRINT COUNT(rec.order_id)
-- -4349: the report aggregate COUNT only accepts *, not a column
Corrected
PRINT COUNT(*)
Diagnostic Checks
- Check every
COUNT/PERCENTaggregate's parameter, and confirm it's*, not a specific column or expression.
Related Errors / Related Topics
- -4348 — "This type of aggregate must be applied to an expression, not ''. Only PERCENT
and COUNT aggregates use ''." The mirror-image error, about aggregates like
MIN/SUMneeding a real expression rather than*.
COUNT/PERCENT is applied to a specific column/expression instead of * — use * for
these aggregates.