Search code examples
sqloracle-databasesyntaxgsp

Oracle SQL Syntax: With clause


I'm currently using the Java Version of General SQL Parser for Oracle for some relatively complex Oracle SQL Queries.

As in my case I have no access to any Oracle DB but only have the SQL statements in a file I encounter some statements where the parser fails, one particular boils down to following.

select id from (
with foo as (
    select bar from sometable
)
select *
from foo
)

The with clause can be parsed without problem, if not nested.

with foo as (
    select bar from sometable
)
select *
from foo

So do I have a bug in the parser or in the statement?

Best, Will


Solution

  • The SQL statement is valid, so I guess the parser just can't handle it.

    To be sure, try running the SQL in SQL Plus.