问题描述
- sql报错,求大神帮忙看看,在线等!
-
Caused by: java.sql.SQLException: sql injection violation, syntax error: TODO : LITERAL_INT top : select top 20 * from (select row_number() over ( order by name asc ) row_number, * from (select id,name,display_Name,type,instance_Url,state, content, version,create_Time,creator from wf_process where 1=1 and state = ? ) aa ) a where row_number > 0 order by row_number
at com.alibaba.druid.wall.WallFilter.check(WallFilter.java:711)
at com.alibaba.druid.wall.WallFilter.connection_prepareStatement(WallFilter.java:240)
at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:448)
at com.alibaba.druid.filter.FilterAdapter.connection_prepareStatement(FilterAdapter.java:928)
at com.alibaba.druid.filter.FilterEventAdapter.connection_prepareStatement(FilterEventAdapter.java:122)
at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:448)
at com.alibaba.druid.filter.FilterAdapter.connection_prepareStatement(FilterAdapter.java:928)
at com.alibaba.druid.filter.FilterEventAdapter.connection_prepareStatement(FilterEventAdapter.java:122)
at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:448)
at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.prepareStatement(ConnectionProxyImpl.java:342)
at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:318)
at org.springframework.jdbc.core.JdbcTemplate$SimplePreparedStatementCreator.createPreparedStatement(JdbcTemplate.java:1436)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:581)
... 126 more
Caused by: com.alibaba.druid.sql.parser.ParserException: TODO : LITERAL_INT top
at com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser.parseStatementList(OracleStatementParser.java:490)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:112)
at com.alibaba.druid.wall.WallProvider.checkInternal(WallProvider.java:619)
at com.alibaba.druid.wall.WallProvider.check(WallProvider.java:574)
at com.alibaba.druid.wall.WallFilter.check(WallFilter.java:699)
... 138 more
解决方案
ORACLE 没有 SELECT TOP 语句,要用行号作为条件进行过滤
select *
from (select row_number() over ( order by name asc ) row_number,
*
from (select id,name,display_Name,type,instance_Url,state, content, version,create_Time,creator
from wf_process
where 1=1
and state = ?
) aa
) a
where row_number BETWEEN 1 AND 20
order by row_number
解决方案二:
试一下,不用TOP就可以,
时间: 2024-09-27 06:47:13