Subject RE: [firebird-support] Re: Possible to write this in a way that indices will be used
Author Sasha Matijasic
> > select blah..,
> > from MyTable D
> > where ((D.SuplCde = :ISupplierCode) or (:ISupplierCode is null))
> > and ((D.WrhseCde = :IWarehouseCode) or (:IWarehouseCode is null))
> > and ((D.StkCde = :IStockCode) or (:IStockCode is null))
> > and ((D.IsActve = 'Y') or (:IIncludeInactive = 'Y'))
>

> Hi Maya,
> If you are using Firebird 2+ Testing DISTINCTness will be a nice way
> to go :
> http://www.firebirdsql.org/manual/nullguide-langelem.html
> <http://www.firebirdsql.org/manual/nullguide-langelem.html>
> Doru
>

I don't thik so. As far as I can see the intention of query is to return specific parametar OR don't look at the parameter at all. If you use "is distinct from" you change the meaing of query.

This is the way to write it, although I would like to be proven wrong on this point.

Sasha