Using rownum greater than or equal to or less than or equal to the result of paging is incorrect in Oracle #490
Closed
Description
在Oracle下使用Shardingjdbc的分页时遇到一个问题,比如我的SQL是:SELECT * FROM (SELECT A1., ROWNUM RN1 FROM (SELECT * FROM t_order ORDER BY user_id DESC) A1 WHERE ROWNUM <= 10) B WHERE B.RN1 >= 1,正常情况下应该返回10条数据,但是Shardingjdbc返回了9条数据,漏掉了本来的第一条数据。我看了一下在每个分片的执行语句:SELECT * FROM (SELECT A1., ROWNUM RN1 FROM (SELECT * FROM t_order_0 ORDER BY user_id DESC) A1 WHERE ROWNUM <= 10) B WHERE B.RN1 >= 0,这里RowNum变成从0开始的,是Shardingjdbc默认RowNum从0开始吗,这里Shardingjdbc的处理逻辑是怎样的呢,还是说这里存在Bug?