功能未实现:WINDOW/ORDER BY [英] Feature not implemented: WINDOW/ORDER BY
问题描述
我正在使用嵌入式Apache Derby数据库并执行以下查询:
I am using an embedded Apache Derby database and execute the following query:
SELECT
someUniqueValue,
row_number() over(ORDER BY someUniqueValue) as ROWID
FROM
myTable;
someUniqueValue
是一个varchar.
someUniqueValue
is a varchar.
我得到了例外:
java.sql.SQLFeatureNotSupportedException:未实现的功能:WINDOW/ORDER BY
java.sql.SQLFeatureNotSupportedException: Feature not implemented: WINDOW/ORDER BY
如果我将查询中的 row_number()
行更改为:
If i change the row_number()
line in my query to:
row_number() over() as ROWID
查询运行正常(尽管结果对我来说毫无用处).
The query runs fine (although the result is useless for me).
Derby文档指出支持.我在做什么错了?
The Derby documentation states this is supported. What am I doing wrong?
推荐答案
您发布的链接只是一个草稿,用于指定功能的实现方式.
The link you posted is just a draft to specify how the feature should be implemented.
如果向下滚动,您会发现:
If you scroll down a bit you find:
从10.4.1.3版本开始,Derby包含ROW_NUMBER()窗口函数的实现.限制和用法说明可以在《 Derby参考手册》中找到
当您查看Derby手册时(您的链接不是手册) http://db.apache.org/derby/docs/10.10/ref/rreffuncrownumber.html ,您会发现一系列限制:
When you then look at Derby manual (your link is not the manual) http://db.apache.org/derby/docs/10.10/ref/rreffuncrownumber.html you'll find a list of limitations:
- Derby当前不允许在OVER()子句中指定已命名或未命名的窗口规范,但是需要一个空括号.这意味着该函数将在整个结果集中进行评估.
- ROW_NUMBER函数当前无法在WHERE子句中使用.
- Derby当前在子查询中不支持ORDER BY,因此当前无法保证SELECT子查询中的行顺序.如果确实需要排序,则可以使用优化器替代来强制优化器使用在所需列上排序的索引.
这篇关于功能未实现:WINDOW/ORDER BY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!