com.alibaba.druid.sql.dialect.oracle.ast.expr.OracleIntervalType 类中枚举类型不完善,导致基础SQL执行直接报错,具体执行SQL如下:
SELECT to_char(sysdate-interval '1' hour,'hh24:mi:ss') as num FROM DUAL;
报错信息如下:
Caused by: java.sql.SQLException: sql injection violation, syntax error: No enum constant com.alibaba.druid.sql.dialect.oracle.ast.expr.OracleIntervalType.hour : SELECT to_char(sysdate-interval '1' hour,'hh24:mi:ss') as num FROM DUAL
at com.alibaba.druid.wall.WallFilter.check(WallFilter.java:724)
at com.alibaba.druid.wall.WallFilter.statement_executeQuery(WallFilter.java:509)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeQuery(FilterChainImpl.java:2360)
at com.alibaba.druid.filter.FilterAdapter.statement_executeQuery(FilterAdapter.java:2481)
at com.alibaba.druid.filter.FilterEventAdapter.statement_executeQuery(FilterEventAdapter.java:302)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeQuery(FilterChainImpl.java:2360)
at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.executeQuery(StatementProxyImpl.java:211)
at com.alibaba.druid.pool.DruidPooledStatement.executeQuery(DruidPooledStatement.java:138)
at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:458)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:408)
... 71 common frames omitted
Caused by: java.lang.IllegalArgumentException: No enum constant com.alibaba.druid.sql.dialect.oracle.ast.expr.OracleIntervalType.hour
at java.lang.Enum.valueOf(Enum.java:238)
at com.alibaba.druid.sql.dialect.oracle.ast.expr.OracleIntervalType.valueOf(OracleIntervalType.java:18)
at com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser.parseInterval(OracleExprParser.java:934)
at com.alibaba.druid.sql.parser.SQLExprParser.primary(SQLExprParser.java:572)
at com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser.primary(OracleExprParser.java:484)
at com.alibaba.druid.sql.parser.SQLExprParser.bitXor(SQLExprParser.java:152)
at com.alibaba.druid.sql.parser.SQLExprParser.multiplicative(SQLExprParser.java:189)
at com.alibaba.druid.sql.parser.SQLExprParser.additiveRest(SQLExprParser.java:1282)
at com.alibaba.druid.sql.parser.SQLExprParser.exprRest(SQLExprParser.java:138)
at com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser.exprRest(OracleExprParser.java:1129)
at com.alibaba.druid.sql.parser.SQLExprParser.expr(SQLExprParser.java:132)
at com.alibaba.druid.sql.parser.SQLExprParser.exprList(SQLExprParser.java:915)
at com.alibaba.druid.sql.parser.SQLExprParser.methodRest(SQLExprParser.java:808)
at com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser.methodRest(OracleExprParser.java:529)
at com.alibaba.druid.sql.parser.SQLExprParser.primaryRest(SQLExprParser.java:776)
at com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser.primaryRest(OracleExprParser.java:691)
at com.alibaba.druid.sql.parser.SQLExprParser.parseSelectItem(SQLExprParser.java:1949)
at com.alibaba.druid.sql.parser.SQLSelectParser.parseSelectList(SQLSelectParser.java:359)
at com.alibaba.druid.sql.dialect.oracle.parser.OracleSelectParser.query(OracleSelectParser.java:264)
at com.alibaba.druid.sql.dialect.oracle.parser.OracleSelectParser.select(OracleSelectParser.java:85)
at com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser.parseStatementList(OracleStatementParser.java:155)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:147)
at com.alibaba.druid.wall.WallProvider.checkInternal(WallProvider.java:620)
at com.alibaba.druid.wall.WallProvider.check(WallProvider.java:574)
at com.alibaba.druid.wall.WallFilter.check(WallFilter.java:711)
... 80 common frames omitted