Subject Re: Is there a parameter value of 'don't care' ?
Author landie_wu
--- In firebird-support@yahoogroups.com, "tickerboo2002" <egroup@...>
wrote:
>
> Users of my app will be able to fill in parameters that go into a
> query to search for rows. The query has fixed parameters in the where
> clause: i.e.
>
> where
> Co_name=:Co_Name and
> town=:town and
> Num_Employees=:Num_Employees
> etc
>
> Let's say the user is not interested in Num_Employees, is it possilble
> to set the parameter so that clause is ignored?
>
> I assume for varchar entries I can just set Col=* (or is it %?)

I'm a newbie in Firebird so I'm only assuming your app calls a stored
proc, and ":Co_name" is a parameter?

Can you set a default for a parameter to be NULL? If so then you can
do things like:

(Co_name = :Co_name || :Co_name = NULL)
AND
(Town = :Town || :Town = NULL)
etc, etc. for each search parameter.

If Firebird has a COALESCE function you can use that instead.

If I interpreted your question the wrong way then please ignore my
ramblings...

Cheers,
Dany.