Skip to content

OPTIMIZE statement cannot be parsed #348

Closed

Description

@msbruno

SQL commands like the sql below cannot be parsed, an exception occurs.

SELECT *
FROM EMP
ORDER BY SALARY DESC
OPTIMIZE FOR 20 ROWS;

Exception: "net.sf.jsqlparser.parser.ParseException: Encountered " <S_IDENTIFIER> "OPTIMIZE "" at line 4, column 3.
Was expecting one of:

"FOR" ..."

Activity

  1. CodingFabian commented on Mar 13, 2017

    @CodingFabian

    +1 here,
    this seems to be trailing to statements:
    e.g. in selects like:

    LIMIT 1 OPTIMIZE FOR 1 ROWS

    Documented in the DB2 documentation:
    https://www.ibm.com/support/knowledgecenter/en/SSEPEK_10.0.0/sqlref/src/tpc/db2z_sql_optimizeforclause.html

    https://www.ibm.com/support/knowledgecenter/SSEPEK_10.0.0/perf/src/tpc/db2z_optimizefornrows.html
    it seems to appear only at the end of a select statement.

  2. added a commit that references this issue on Feb 7, 2019
    ff23dde
  3. added a commit that references this issue on Feb 16, 2019
    4146430
  4. added a commit that references this issue on Feb 19, 2019
    2830c17
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