SQL238 LEXICAL Analysis has detected an invalid TOKEN Expecting a WITH token
search cancel

SQL238 LEXICAL Analysis has detected an invalid TOKEN Expecting a WITH token

book

Article ID: 118768

calendar_today

Updated On:

Products

Plan Analyzer for DB2 for z/OS

Issue/Introduction

During the explain of a complex SQL statement user Plan Analyzer for Db2 for z/OS (PPA) the explain produces an error for complex SQLs.

In this case it produces:
SQL238: LEXICAL Analysis has detected an invalid TOKEN Expecting a WITH token or

Resolution

This problem is related to nested table expressions no longer being required to include a correlation clause.  As a workaround, a correlation id needs
to be added after the last paren in order to explain the statement without getting a parser error. 

Here is the syntax to add: CORR-ID FOR READ ONLY WITH UR