ORA-30485: missing ORDER BY expression in the window specification ORACLE 报错 故障修复 远程处理
文档解释
ORA-30485: missing ORDER BY expression in the window specification
Cause: Either the ORDER BY expression is mandatory for this function, or there is an aggregation group without any ORDER by expression.
Action: None
ORA-30485错误是由窗口规范中缺少ORDER BY表达式引起的。
官方解释
ORA-30485错误指示ORDER BY子句采用的窗口描述符,但窗口描述符中没有指定ORDER BY子句。要解决此错误,必须修复SELECT语句中表示排序顺序的窗口规范中的ORDER BY语句。
常见案例
下面的查询语句中存在ORA-30485错误:
SELECT name, RANK() OVER (PARTITION BY dept_id)
FROM employees
WHERE salary > 10000;
正确处理:
要解决此错误,可以修复SELECT语句中表示排序顺序的窗口规范中的ORDER BY子句,即:
SELECT name, RANK() OVER (PARTITION BY dept_id ORDER BY salary)
FROM employees
WHERE salary > 10000;