Subject | Re: [firebird-support] Dynamic ORDER BY in SP |
---|---|
Author | Max Renshaw-Fox |
Post date | 2007-01-10T00:07:18Z |
Perhaps I should have been clearer:
I meant that since the parameter would have to be constructed outside the
SP anyway - why not just construct an order by clause (I wasn't suggesting
to use the *actual* parameter externally, or internally, to the SP -
sorry).
I take Adam's point about index walks vs in-mem sorts - and agree that
it's context-specific - and may be why Vlad doesn't want to go this way.
Max
no-op, but you could....
IN_ORDER_BY.
to Square One, actually, still needing an input variable to be used to
form the set either conditionally or using EXECUTE
I meant that since the parameter would have to be constructed outside the
SP anyway - why not just construct an order by clause (I wasn't suggesting
to use the *actual* parameter externally, or internally, to the SP -
sorry).
I take Adam's point about index walks vs in-mem sorts - and agree that
it's context-specific - and may be why Vlad doesn't want to go this way.
Max
> At 09:12 AM 10/01/2007, Max Renshaw wrote:(which it's not in this example) you could. It would be a horrible
>>Is it not possible to:
>>SELECT * FROM GET_DATA(IN_USER_ID) ORDER BY IN_ORDER_BY
>>ie order outside the SP?
>
> If IN_ORDER_BY is an output field of the selectable stored procedure
no-op, but you could....
>increment this variable at each turn of the loop. The entire
> You would need to define IN_ORDER_BY as a RETURNS() item and
> implement some mechanism inside the processing loop in the SP to
> procedure would have to execute before there was anything to sort by,i.e. the whole output set, encompassing all of the values of
IN_ORDER_BY.
>processing the underlying records in the desired order...so you are back
> In practical terms it would be useless/pointless. For this
> manufactured ordering field to be meaningful, your SP would need to be
to Square One, actually, still needing an input variable to be used to
form the set either conditionally or using EXECUTE
> STATEMENT in a FOR loop...
>
> ./heLen
>
>