Subject Re: [firebird-support] SELECT limitation with UNION/GROUP BY (NOW: View with case statement)
Author Darryl
Thanks for your quick response.

I have restructured my SELECT statements using CASE clauses and this seems
to be a nice solution. My SELECT statement runs correctly, however, I get a
parsing error when trying to create the VIEW.

Does anyone know what could be causing this error?

CREATE VIEW COUNT_STOCK_BY_SIZES( ENTITY_ID, SIZE_GROUP_ID,
PRODUCT_STYLE_ID, COLOUR_ID,
TRANSACTION_DATE, F_1, F_2, F_3, F_4, F_5, F_6, F_7, F_8, F_9)
AS
select cast((STORE_ID * 100) + 2 as INTEGER) as ENTITY_ID, SIZE_GROUP_ID,
P.PRODUCT_STYLE_ID,
COLOUR_ID, TRANSACTION_DATE,
case SIZE_ID
WHEN 1 then QUANTITY <<<<<<<<<<<<<<< "Parsing error!" message on
this line.
WHEN 7 then QUANTITY
WHEN 13 then QUANTITY
end,
case SIZE_ID /* 2 */
WHEN 2 then QUANTITY
WHEN 8 then QUANTITY
WHEN 14 then QUANTITY
end,
< SNIP>

Regards,

Darryl

----- Original Message -----
From: "Arno Brinkman" <firebird@...>
To: <firebird-support@yahoogroups.com>
Sent: Thursday, August 21, 2003 11:21 AM
Subject: Re: [firebird-support] SELECT limitation with UNION/GROUP BY


> Hi,
>
> > I am trying to run a SELECT statement that UNIONS a number of reasonably
> > complex VIEWS. This causes a nasty error that crashes the FB server (I
> just
> > updated from 1.03 to 1.5 RC5 in the vain hope that this would go away.)
> >
> > The error I am getting is "Unsuccessful execution caused by a system
error
> > that precludes successful execution of subsequent statements.
> > internal gds software consistency check (missing pointer page in
> > DPM_data_pages (243))."
> >
> > I believe that this is a system limitation as I can run the SELECT with
> any
> > 8 of the 9 UNIONs.
>
> Looking at your metadata i think it exceeds the internal 255 limit.
>
> Your view uses ((3 tables + 1 aggregate) * 5) + 4 unions = 24
> Your main select ((24 + 1 for view self) * 9) + 8 unions = 233
> 1 select more and you exceed the 255.
>
> Not that it should crash!
> I don't think there's a workaround for this.
>
> Regards,
> Arno Brinkman