Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oracle 分析函数解析报错 #4059

Closed
neozo opened this issue Nov 25, 2020 · 2 comments
Closed

oracle 分析函数解析报错 #4059

neozo opened this issue Nov 25, 2020 · 2 comments
Labels
Milestone

Comments

@neozo
Copy link

neozo commented Nov 25, 2020

1.2.3版本

    @Test
    public void testSqlPars() {
        // 此sql可以正常执行
        String sql ="SELECT B.CUSTOMER_ID customerId,B.CN_NAME NAME,OPENING_DATE,CLOSING_DATE,count(A.OPENING_DATE) over (partition BY B.CUSTOMER_ID ORDER BY trunc(A.OPENING_DATE,'mm') RANGE BETWEEN interval '3' month (4) preceding AND CURRENT ROW) AS createCount,count(A.CLOSING_DATE) over (partition BY B.CUSTOMER_ID ORDER BY trunc(NVL(A.CLOSING_DATE,SYSDATE),'mm') RANGE BETWEEN interval '3' month (4) preceding AND CURRENT ROW) AS cancelCount,row_number () over (partition BY B.CUSTOMER_ID ORDER BY trunc(A.OPENING_DATE) DESC) AS row_flg FROM account_info A,CUSTOMER_INFO B WHERE A.CUSTOMER_ID=B.CUSTOMER_ID";
        SQLUtils.format(sql, DbType.oracle);
    }

报错:

com.alibaba.druid.sql.parser.ParserException: syntax error, expect AND, actual IDENTIFIER pos 210, line 1, column 202, token IDENTIFIER preceding
	at com.alibaba.druid.sql.parser.SQLExprParser.accept(SQLExprParser.java:3980)
	at com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser.parseAggregateExpr(OracleExprParser.java:866)
	at com.alibaba.druid.sql.parser.SQLExprParser.methodRest(SQLExprParser.java:1554)
	at com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser.methodRest(OracleExprParser.java:495)
	at com.alibaba.druid.sql.parser.SQLExprParser.parseSelectItem(SQLExprParser.java:5432)
	at com.alibaba.druid.sql.parser.SQLSelectParser.parseSelectList(SQLSelectParser.java:973)
@wenshao wenshao added the Bug label Dec 12, 2020
@wenshao wenshao added this to the 1.2.4 milestone Dec 12, 2020
@wenshao
Copy link
Member

wenshao commented Dec 12, 2020

@neozo
Copy link
Author

neozo commented Dec 16, 2020

https://github.com/alibaba/druid/releases/tag/1.2.4
请用新版本

感谢修复,现在没报错了,但貌似引入了一个新但bug ,format 以后 BETWEEN 关键字丢失了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants