@@ -259,6 +259,7 @@ TOKEN: /* SQL Keywords. prefixed with K_ to avoid name clashes */
259259| <K_CONNECT:"CONNECT">
260260| <K_PRIOR:"PRIOR">
261261| <K_NOCYCLE:"NOCYCLE">
262+ | <K_SIBLINGS:"SIBLINGS">
262263}
263264
264265
@@ -629,7 +630,8 @@ PlainSelect PlainSelect():
629630 [ oracleHierarchicalQueryClause=OracleHierarchicalQueryClause() { plainSelect.setOracleHierarchical(oracleHierarchicalQueryClause); } ]
630631 [ groupByColumnReferences=GroupByColumnReferences() { plainSelect.setGroupByColumnReferences(groupByColumnReferences); }]
631632 [ having=Having() { plainSelect.setHaving(having); }]
632- [LOOKAHEAD(2) orderByElements = OrderByElements() { plainSelect.setOrderByElements(orderByElements); } ]
633+ [LOOKAHEAD(<K_ORDER> <K_SIBLINGS> <K_BY>) orderByElements = OrderByElements() { plainSelect.setOracleSiblings(true); plainSelect.setOrderByElements(orderByElements); } ]
634+ [LOOKAHEAD(<K_ORDER> <K_BY>) orderByElements = OrderByElements() { plainSelect.setOrderByElements(orderByElements); } ]
633635 [LOOKAHEAD(2) limit = Limit() { plainSelect.setLimit(limit); } ]
634636
635637 {
@@ -1131,7 +1133,7 @@ List<OrderByElement> OrderByElements():
11311133 OrderByElement orderByElement = null;
11321134}
11331135{
1134- <K_ORDER> <K_BY> orderByElement=OrderByElement() { orderByList.add(orderByElement); }
1136+ <K_ORDER> [ <K_SIBLINGS> ] <K_BY> orderByElement=OrderByElement() { orderByList.add(orderByElement); }
11351137 ("," orderByElement=OrderByElement() { orderByList.add(orderByElement); } )*
11361138 {
11371139 return orderByList;
@@ -1311,10 +1313,11 @@ Expression RegularCondition():
13111313 Expression rightExpression;
13121314 boolean not = false;
13131315 int oracleJoin=EqualsTo.NO_ORACLE_JOIN;
1316+ int oraclePrior=EqualsTo.NO_ORACLE_PRIOR;
13141317}
13151318{
13161319
1317- [ <K_PRIOR> ]
1320+ [ <K_PRIOR> { oraclePrior = EqualsTo.ORACLE_PRIOR_START; } ]
13181321 [ <K_NOT> { not = true; } ]
13191322 leftExpression=ComparisonItem() { result = leftExpression; }
13201323
@@ -1331,7 +1334,7 @@ Expression RegularCondition():
13311334 )
13321335 rightExpression=ComparisonItem()
13331336
1334- [ <K_PRIOR> ]
1337+ [ <K_PRIOR> { oraclePrior = EqualsTo.ORACLE_PRIOR_END; } ]
13351338 [ "(+)" { oracleJoin=EqualsTo.ORACLE_JOIN_LEFT; } ]
13361339
13371340 {
@@ -1343,6 +1346,9 @@ Expression RegularCondition():
13431346
13441347 if (oracleJoin>0)
13451348 ((SupportsOldOracleJoinSyntax)result).setOldOracleJoinSyntax(oracleJoin);
1349+
1350+ if (oraclePrior!=EqualsTo.NO_ORACLE_PRIOR)
1351+ ((SupportsOldOracleJoinSyntax)result).setOraclePriorPosition(oraclePrior);
13461352 }
13471353
13481354 { return result; }
0 commit comments