Hi,
I asked this in the support list, but got no answer:

I do not understand why

set planonly;
with recursive
  CTE_CNT1 as (select 0 as I
    from RDB$DATABASE
    union all select I + 1
    from CTE_CNT1
    where I < 9),

  CTE_CNT2 as (select I, 0 as J
    from CTE_CNT1
    union all select J * 10 + c1.I, c2.J + 1
    from CTE_CNT1 c1
    join CTE_CNT2 c2 on c2.J < 10)

select I from CTE_CNT2;

fails with:
Statement failed, SQLSTATE = 42S22
Dynamic SQL Error
-SQL error code = -206
-Column unknown
-C2.J
-At line 14, column 15

while the similar

with recursive
  CTE_CNT1 as (select 0 as I
    from RDB$DATABASE
    union all select I + 1
    from CTE_CNT1
    where I < 9),

  CTE_CNT2 as (select 0 as I, 0 as J
    from RDB$DATABASE
    union all select J * 10 + c1.I, c2.J + 1
    from CTE_CNT1 c1
    join CTE_CNT2 c2 on c2.J < 10)

select I from CTE_CNT2;

succeds with

PLAN (CTE_CNT2 RDB$DATABASE NATURAL, CTE_CNT2 CTE_CNT1 RDB$DATABASE
NATURAL, JOIN ())

Frank

-- "Fascinating creatures, phoenixes, they can carry immensely heavy
loads, their tears have healing powers and they make highly faithful
pets." - J.K. Rowling

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to