Subject | Re: Any way to use an input parameter in an order by clause |
---|---|
Author | Adam |
Post date | 2006-06-29T00:52:10Z |
--- In firebird-support@yahoogroups.com, "Rick Debay" <rdebay@...> wrote:
Already tried that, it does not work ;)
Hence I wrote:
but is acceptable. Due to the way it works, it is nearly impossible
for the procedure to return more than 5 records, and it is unlikely to
return more than one or two.
I have changed it to a for select loop, which calculates the
difference inside. I then have a stored procedure that selects first 1
from the stored procedure ordered by the difference.
I do not like it because Firebird must entirely build the results from
the first procedure before return.
Adam
>Hi Rick,
> select col1, col2, col3, ABS(somefield - :someparameter)
> from sometable
> order by 4
Already tried that, it does not work ;)
Hence I wrote:
> I have also tried moving this logic into the select with the intentionI have got around the problem in a way I am not totally happy with,
> of using the order by [fieldnumber] syntax, but it has the same problem.
but is acceptable. Due to the way it works, it is nearly impossible
for the procedure to return more than 5 records, and it is unlikely to
return more than one or two.
I have changed it to a for select loop, which calculates the
difference inside. I then have a stored procedure that selects first 1
from the stored procedure ordered by the difference.
I do not like it because Firebird must entirely build the results from
the first procedure before return.
Adam