文档解释
ORA-13141: invalid RANGE window definition
Cause: The RANGE window specified is not correctly defined.
Action: A RANGE window is defined by specifying the lower and upper boundary of each dimension as a pair of values (e.g.: lower_bound1,upper_bound1,lower_bound2,upper_bound2,…). There should be an even number of values.
官方解释
ORA-13141: invalid RANGE window definition
Cause: This error occurs when the RANGE clause specification is not valid.
Action: The start and end points of the window specification must line up with the right boundary of a row and may have a non-negative integer offset. The size of the window must also be positive and non-zero.
常见案例
这种错误通常在使用RANGE子句或WINDOW子句时发生,因为窗口的范围设定不正确。
正常处理:
正确地设置RANGE子句或WINDOW子句的范围,避免发生此错误。例如,在以下SQL语句中,可以将Window设定为两行:
SELECT avg(amount)
OVER (PARTITION BY customer_id
RANGE BETWEEN CURRENT ROW AND 2 FOLLOWING)
FROM orders;