JSqlParser
JSqlParser copied to clipboard
parse args in case when error
I have a stamemnt than run ok in postgresql : select * from customer m where id=case when id > max(id, :maxValue) then 1 else 2 end, max is customized defined function, but sql parser error: `10:58:25.213 [main] ERROR com.q7link.framework.sql.utils.SqlParser - parse sql error : select * from customer m where id=case when id > max(id, :maxValue) then 1 else 2 end
java.lang.RuntimeException: net.sf.jsqlparser.JSQLParserException: Encountered unexpected token: "(" "(" at line 1, column 53.`
change arg maxValue to maxValue, it work fine. does maxValue is keyword not as argument name? change arg maxValue to max, eg. "select * from customer m where id=case when id > max(id, :max) then 1 else 2 end", it work without error.
also, "UR" | "RS" | "RR" | "CS" cannot as table alias, too.
it all work fine at version 1.4, now update to 4.4, many statement error occor.:(
On Mon, 2022-07-11 at 20:59 -0700, wolfjiang wrote:
"UR" | "RS" | "RR" | "CS"
Those keywords have been allowed again in 4.5-Snapshot. Please download the latest Snapshot, there is a Maven Artifact available.
Bets regards Andreas
On Mon, 2022-07-11 at 20:59 -0700, wolfjiang wrote: "UR" | "RS" | "RR" | "CS" Those keywords have been allowed again in 4.5-Snapshot. Please download the latest Snapshot, there is a Maven Artifact available. Bets regards Andreas
OK, thanks
But, The maxValue not fix
But, The maxValue not fix
Greetings! Good catch:
-- works
select fun( id, ?);
-- works
select fun( id, :param);
-- fails since "maxValue" is not an allowed token?
select fun( id, :maxValue);
Works with JSQLParser 4.6. http://jsqlformatter.manticore-projects.com/jsqlformatter/demo.html?args=-c%20LTAEHcHsCcGsGcBQBlAogGVQYQCqgGICuAdgBSgCWAJgDSgD8oAlIgNyIcgQwIobZ4iZSrVAAuAA4BDaFIC2zNh0RcAZlIoAbeKHgViAYwCmoAERypADwBqUzYSOnKO4pAAuoKcU+bNkcEZUoG6QsEbE9HyYuAQk5NR0YhY2dg6KrEA