JSqlParser
JSqlParser copied to clipboard
Cannot use MySQL user variables after INTO clause
Describe the bug Using MySQL user variables after the INTO clause in a SELECT is a perfectly valid MySQL query. But the parse is unable to parse such a query.
To Reproduce Steps to reproduce the behavior:
- Example SQL:
SELECT COUNT(*) INTO @countTotal FROM employee; - Parsing this SQL using JSqlParser with this statements:
try { Statement userVariableAfterInto = CCJSqlParserUtil.parse("SELECT COUNT(*) INTO @countTotal FROM employee;"); } catch (JSQLParserException e) { e.printStackTrace(); } - Exception
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "@" "@" at line 1, column 22. Was expecting one of: "ACTION" "ANY" "BYTE" "CASCADE"
Expected behavior It should be possible to use MySQL user variables after the INTO clause of the SELECT query.
System
- Database you are using: MySQL
- Java Version: 11.0.3
- JSqlParser version: 3.0