Informix Error -447
-447 The numeric value provided for the FIRST, LIMIT or SKIP clauses must be
greater than zero.The numeric value provided for the FIRST, LIMIT or SKIP clauses is negative. It must be a value greater than zero.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-447 fires when a negative numeric value is supplied to FIRST, LIMIT, or SKIP — these
clauses require a positive value, and a negative row count or offset has no sensible meaning for
any of them.
- A negative literal accidentally supplied to
FIRST/LIMIT/SKIP— a typo or sign error. - A computed/parameterized value that evaluates to negative at runtime — e.g. a pagination
offset calculation that produces a negative number for an edge case (such as page number
0or a negative page index). - Application pagination logic with an off-by-one or unguarded edge case, passing a negative
SKIPvalue for the first page instead of0.
Solutions / Resolution
- Ensure the value supplied to
FIRST/LIMIT/SKIPis a positive number, per the official guidance. - Add validation/clamping to pagination logic that computes these values dynamically, so a negative page index or offset never reaches the SQL statement.
- Review the specific computation producing the value if it's parameterized, to find where a negative result can occur.
Examples
A negative computed SKIP value
-- page_number could be 0 or negative in some edge case,
-- producing a negative SKIP value:
SELECT SKIP :offset FIRST 20 * FROM orders;
-- -447 if :offset evaluates to a negative number
Fix — clamp the offset to a non-negative value before use:
offset = MAX(0, (page_number - 1) * page_size)
A straightforward negative literal
SELECT FIRST -5 * FROM orders;
-- -447: -5 isn't a valid FIRST value
Diagnostic Checks
- Check the actual runtime value being supplied to
FIRST/LIMIT/SKIP, not just its declared type. - Review pagination logic for edge cases (page
0, negative page numbers) that could produce a negative offset.
Related Errors / Related Topics
- -201 — "A syntax error has occurred." The general SQL-parsing-error family this fits into.
Check pagination logic for edge cases that can produce a negative offset or limit — this is the most common real-world source of an unexpectedly negative value reaching these clauses.