Subject Re: [firebird-support] Re: Possible to write this in a way that indices will be used
Author Milan Babuskov
Maya Opperman wrote:
> If :IInputParam is null then
> .. do SQL without mentioning input param
> Else
> .. re-do same sql, but this time add where t.Field = :IInputParam

For such cases, I have a simple find&replace function that rewrites the
query. I write statements like this:

where ... { and t.Field = :IInputParam }

after params are filled, the function reads the SQL statements looking
for { } and when param inside it is NULL it removes the {...} part
completely.

HTH

--
Milan Babuskov
http://www.flamerobin.org