Subject Re: Is there possibility to return dynamic number of columns from EXECUTE BLOCK /SP?
Author un_spoken
--- In firebird-support@yahoogroups.com, "unordained" <unordained_00@...> wrote:
>
> ---------- Original Message -----------
> From: "un_spoken" <brucedickinson@...>
> > regarding option b)
> >
> > > b) if there's more to it, dynamically build up the EXECUTE BLOCK as you did
> > > above, then execute the whole thing as a statement (keeping in mind that you
> > > need to build up a statement that looks like:
> > >
> > > execute block (parameter names and types...) returns (column names and
> > > types...) as
> > > begin
> > > for select ... into ... do suspend;
> > > end
> >
> > When I dynamically build the EXECUTE BLOCK it will have different
> > columns number for each execution. Because of that I will be not
> > possible to execute it as a statement since when I am executing it as
> > a statement I would also have to define the returning columns, right?
> ------- End of Original Message -------
>
> You can (and must) dynamically create the returns() clause, to match. Your
> "template" would therefore look like:
>
> execute block returns ( /*dynamically-built*/ ) as
> begin
> for select /*dynamically-built*/ into /*dynamically-built*/ do suspend;
> end
>
> Does that explain it?
>
> -Philip
>

Yeah, thanks :)