pcyan opened a new issue, #17477:
URL: https://github.com/apache/shardingsphere/issues/17477

   version
   ```
   <groupId>org.apache.shardingsphere</groupId>
   <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
   <version>5.1.1</version>
   ```
   
   testcase
   ```java
   def "testOraclePagination"() {
   
           when: "pagination case 1"
           def pagination_sql2 = """
       select * from (
       select t1."num",rownum as "rownum_" from(
           select 'a'  as "num" from dual)t1)
       where "rownum_" >? and "rownum_"< ?
   """
   
           try (def connection = 
sqlSessionFactory.openSession().getConnection()) {
               connection.prepareStatement(pagination_sql2)
           }
           then:
           noExceptionThrown()
   
           when: "pagination case 2"
           def pagination_sql3 = """
       select t2."num",t2,"rownum_" from (
       select t1."num",rownum as "rownum_" from(
           select 'a'  as "num" from dual)t1)t2
       where t2."rownum_" > ? and t2."rownum_" <= (?+?)
   """
   
           try (def connection = 
sqlSessionFactory.openSession().getConnection()) {
   
               connection.prepareStatement(pagination_sql3)
           }
           then:
           noExceptionThrown()
   
   
           when: "pagination case 3"
           def pagination_sql4 = """
       select * from (
       select t1."num",rownum as "rownum_" from(
           select 'a'  as "num" from dual)t1)
       where t2."rownum_" > ? and t2."rownum_" <= (?+?)
   """
   
           try (def connection = 
sqlSessionFactory.openSession().getConnection()) {
   
               connection.prepareStatement(pagination_sql4)
           }
           then:
           noExceptionThrown()
       }
   ```
   
   pagination case 3 throw exception
   ```
   Caused by: java.lang.ClassCastException: class 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.complex.CommonExpressionSegment
 cannot be cast to class 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.ParameterMarkerExpressionSegment
 
(org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.complex.CommonExpressionSegment
 and 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.ParameterMarkerExpressionSegment
 are in unnamed module of loader 'app')
        at 
org.apache.shardingsphere.infra.binder.segment.select.pagination.engine.RowNumberPaginationContextEngine.createRowNumberValueSegment(RowNumberPaginationContextEngine.java:142)
        at 
org.apache.shardingsphere.infra.binder.segment.select.pagination.engine.RowNumberPaginationContextEngine.createPaginationWithRowNumber(RowNumberPaginationContextEngine.java:129)
        at 
org.apache.shardingsphere.infra.binder.segment.select.pagination.engine.RowNumberPaginationContextEngine.createPaginationContext(RowNumberPaginationContextEngine.java:67)
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to