Skip to content

parse error between with oracle outer join(+) #672

Closed

Description

@realizm

Actual Behavior

Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "BETWEEN" "BETWEEN"
at line 1, column 49.

Was expecting one of:

"."
";"
"AND"
"CONNECT"
"EXCEPT"
"FOR"
"GROUP"
"HAVING"
"INTERSECT"
"MINUS"
"ORDER"
"START"
"UNION"
<EOF>

at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:18047)

Steps to Reproduce the Problem

String sql = "SELECT * FROM table1 t1,table2 t2 WHERE t1.col1 BETWEEN t2.col2(+) AND t2.col3(+)";

JSqlParser jSqlParser = new CCJSqlParserManager();
try {
jSqlParser.parse(new StringReader(sql));
} catch (JSQLParserException e) {
e.printStackTrace();
}

Specifications

  • Version: 1.2
  • Platform: JDK 1.7
  • Subsystem:

Activity

  1. wumpz commented on Sep 8, 2018

    @wumpz
    Member

    That is right. JSqlParser does not support this old join syntax in this between construct.

  2. fudianchn commented on Sep 8, 2026

    @fudianchn
    Contributor

    AI disclosure: this comment was prepared with AI coding agents, reviewed and revised line by line by me.

    Root cause: the grammar consumes the Oracle (+) postfix at three sites (after the condition left operand in Condition(), after the comparison right-hand side in RegularConditionRHS(), and in PrimaryExpression() only before , or ) for IN lists), but the BETWEEN start and end operands reach none of them, so BETWEEN t2.col2(+) fails on the ( token.

    Fix proposed in #2564: consume (+) after both BETWEEN operands (same block Condition() already uses), marking the operand Column via the existing SupportsOldOracleJoinSyntax interface, no AST change. All operand forms covered: both-marked, single-sided, NOT BETWEEN, SYMMETRIC, parenthesized conditions, join ON clauses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions