Subject [firebird-support] Re: Full Cross Tab but unknown column headers
Author Svein Erling Tysvær
>By the way, google's query language has a PIVOT syntax:
>
>https://developers.google.com/chart/interactive/docs/querylanguage#Pivot
>
>Eg.
>
>select sum(salary) pivot dept
>
>Would be nice if Firebird could do the same, I understand you couldn't use it inside a
>stored procedure, where your columns need to be known up front, but your could use it
>to query your selectable stored procedure, which would be very nice ;-)

I agree, Maya, I would even say that if it was possible to return rows from EXECUTE BLOCK without having to specify the RETURNS clause, that it would be a good start (if EXECUTE BLOCK just returned the last executed statement, then Bhavbhuti could possibly use EXECUTE BLOCK ... FOR EXECUTE STATEMENT :MyDynamicallyCreatedStatement DO SUSPEND; ...).

However, such a change would also mean that you wouldn't know the field structure of the result before you actually execute the statement (today you know it once the query is prepared), and it wouldn't surprise me (I know nothing about the Firebird code) if that would be a change with undesirable side effects.

Set