Subject Re: Stored procedure question - can this be done?
Author Adam
--- In firebird-support@yahoogroups.com, <myles@...> wrote:
>
> I want to be able to programmatically change the sorted order of
SELECT
> statements executed in a stored procedure, based on an input value
passed to
> the SP. Without creating a mound of IF ELSE statements, is there a
way to
> somehow have the statement:
>
> ORDER BY <column> ASCENDING
>
> Be represented as:
>
> ORDER BY <column> <direction>
>
> By passing the column and direction values as references to the
INPUT
> variables to the SP?

Yes with EXECUTE STATEMENT.
You are limited in that you have to then do your own casting for
other parameters though.

Adam