Suppose following simple recursive query r
to list several numbers. When recursive part of query is cross joined with unnecessary 1-row table using old way with comma separation, everything works fine (dbfiddle):
with r (x) as (
select 1 as x from dual
union all
select x + 1 from r,dual where x < 5
)
select * from r
If I change comma to cross join
clause, I get ORA-32044: cycle detected while executing recursive WITH query
error (dbfiddle):
with r (x) as (
select 1 as x from dual
union all
select x + 1 from r cross join dual where x < 5
)
select * from r;
Reproduced on Oracle 11g (my project db) and Oracle 18 (dbfiddle). The case is minimized, originally it is hierarchical query on graph data where auxiliary relation with 2 rows representing edge endpoints was cross joined in such a way.
I can (unwillingly) live with first syntax though I have bad feeling of dark undocumented corner or Oracle to build query upon. I didn't find any reasoning for such behaviour nor track of bug. Do anybody knows any? Thanks.