Informix Error -25860: The offset of the LEAD, LAG window function is invalid.
Cause and resolution
The offset of the LEAD, LAG window function is invalid.
The argument of LEAD, LAG NTILE window function needs to be positive numeric type with scale 0(zero).
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-25860 fires when LEAD()/LAG()'s offset argument isn't a positive numeric value with
scale 0 — per the official guidance.
- A
LEAD()/LAG()offset that's negative or has a non-zero scale, per the official guidance — the direct, only cause.
Solutions / Resolution
- Supply a positive numeric offset with scale 0 (e.g.
INTEGER), per the official guidance.
Examples
An invalid LAG offset
SELECT customer_id, LAG(total, -2) OVER (ORDER BY order_date) FROM orders;
-- -25860: -2 is not a valid positive, scale-0 offset
Corrected
SELECT customer_id, LAG(total, 2) OVER (ORDER BY order_date) FROM orders;
Diagnostic Checks
- Check the offset argument passed to
LEAD/LAG, and confirm it's a positive, scale-0 numeric value.
Related Errors / Related Topics
- -25859 — "The argument to NTILE window function is invalid." A related
window-function argument-validity error, for
NTILErather thanLEAD/LAG. - -25861 — "The types of default expression and expression of LEAD, LAG are not
compatible." A related
LEAD/LAGerror, on the default-value expression's type rather than the offset.
LEAD/LAG's offset wasn't a positive, scale-0 numeric value — supply one.