Subject Re: Coalesce and OR condition didn't use indices... other ways?
Author svein_erling
Well, yes, Gabry, there is one further possibility - FOR EXECUTE STATEMENT. Take a look at Firebird 1.5 release notes, pages 40-42 (and read the warnings). Generally, I recommend using COALESCE for some situations like yours, but not for a completely general procedure - normally you would want to have some conditions that are always given and that reduces the potential result set to a feasible number of rows and then apply COALESCE to some additional and optional parts of the query. If that's not possible in your situation and using IF ... ELSE ... is also unfeasible, then FOR EXECUTE STATEMENT may be a solution for you.

Though I must admit I've never used FOR EXECUTE STATEMENT.

HTH,
Set

--- In firebird-support@yahoogroups.com, Gabry Agostinelli wrote:
> Hi all!
> I see that nobody answer my question... I'm sorry but I would like
> to know if the problem has no solution or if I don't explain enough
> the situation. Are there ways to filter data in a table with a
> variable filter using correctly indices?
> Thanks!
>
> Gabry