【发布时间】:2015-04-29 15:29:35
【问题描述】:
以下查询在 hsqldb 2.3.2 中失败,sql.syntax_ora=true。
在 Oracle 11 中运行良好。
它是一个休眠的命名查询,在 TestNG 测试中使用到内存中的 hsqldb 而不是真正的 Oracle。
错误信息是:java.sql.SQLSyntaxErrorException: unexpected token: ORDER required: ) : line: 16, 指的是 row_number() over (order by lastUpdateTime desc) 区域:
select
id as id1_9_0_,
version as version2_9_0_,
lastUpdateTime as lastUpda7_9_0_,
eventType as eventTyp3_9_0_,
clientJid as clientJi4_9_0_,
topicName as topicNam5_9_0_,
attributes as attribut6_9_0_
from (select logEvents.id as id,
logEvents.version as version,
logEvents.lastUpdateTime as lastUpdateTime,
logEvents.eventType as eventType,
logEvents.clientJid as clientJid,
logEvents.topicName as topicName,
logEvents.attributes as attributes,
row_number() over (order by lastUpdateTime desc) rn from xyz_logEvent logEvents)
where rn between 1 and 4 order by rn;
【问题讨论】:
标签: sql oracle compatibility hsqldb named-query