Informix Error -470: The value of occurrence must be greater than 0.
Cause and resolution
The value of occurrence must be greater than 0.
If you include the WITH MAX occurrences clause in the ALLOCATE DESCRIPTOR statement, you must specify a value of occurrences that is greater than zero. Change the value of occurrences to a positive integer, and execute the ALLOCATE DESCRIPTOR statement again.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-470 fires when ALLOCATE DESCRIPTOR ... WITH MAX occurrences specifies an occurrences value
that isn't a positive integer — a descriptor needs at least one item slot to be meaningful, so
zero or negative isn't valid.
- A literal zero or negative value supplied for
occurrences— a typo or sign error. - A computed/parameterized value that evaluates to zero or negative at runtime — e.g. a column-count calculation that produces an unexpected result for an edge case (a query with no select-list items yet, for instance).
Solutions / Resolution
- Modify the occurrences value to be greater than zero and re-execute the
ALLOCATE DESCRIPTORstatement, per the official guidance. - If the value is computed dynamically, add validation to ensure it's always positive before
constructing the
ALLOCATE DESCRIPTORstatement.
Examples
A negative or zero occurrences value
ALLOCATE DESCRIPTOR 'desc1' WITH MAX 0;
-- -470: occurrences must be greater than 0
Fix — use a positive value matching the expected number of columns/parameters:
ALLOCATE DESCRIPTOR 'desc1' WITH MAX 10;
Diagnostic Checks
- Check the actual occurrences value being supplied, especially if computed dynamically.
- Trace back to where a zero or negative value could originate, if the value isn't a plain hardcoded literal.
Related Errors / Related Topics
- -469 — "This descriptor does not exist." A related descriptor-usage error, about a missing allocation rather than an invalid parameter on the allocation itself.
- -447 — "The numeric value provided for the FIRST, LIMIT or SKIP clauses must be greater than zero." A conceptually similar "value must be positive" restriction, in a different clause context.
Ensure the occurrences value supplied to ALLOCATE DESCRIPTOR ... WITH MAX is always a positive
integer, especially when computed dynamically from the number of expected columns/parameters.