我正在使用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]