使用Oracle模式的H2数据库因row_number()失败而失败(按cust.id排序)

时间:2017-02-17 12:00:43

标签: oracle unit-testing h2

我正在使用H2内存数据库进行Oracle查询的单元测试。我写了SET MODE Oracle声明。

但是,oracle查询的下方部分失败了:

row_number() over ( order by cust.id ) as CustCount

我知道在H2 db中不允许这样做,但我们已将模式设置为Oracle。此外,我无法更改查询,因为prod数据库是Oracle,H2 db仅用于单元测试。那么,如何为此编写单元测试?

修改

例外:

org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "SELECT RESULTS.* FROM (SELECT ROW_NUMBER() OVER ( ORDER[*] BY CUST.ID ) AS CUSTCOUNT,   CUST.ADDRESS1 FROM CUSTOMER) RESULTS WHERE CUSTCOUNT BETWEEN 1 AND 50  "; expected ")"; SQL statement:
SELECT RESULTS.* FROM (SELECT ROW_NUMBER() OVER ( ORDER[*] BY CUST.ID ) AS CUSTCOUNT,   CUST.ADDRESS1 FROM CUSTOMER) RESULTS WHERE CUSTCOUNT BETWEEN 1 AND 50  [42001-193]

0 个答案:

没有答案