Subject Re: [firebird-support] Problem with query parameter
Author Harriv
On Tue, Mar 10, 2009 at 5:05 PM, <Alan.Davies@...> wrote:
>
> No it isn't possible, which is what the error is telling you.
> You can't select anything from a table based on a parameter you are
> setting if that parameter is null. What do you expect back??
> If you want a set of records where their value is null, then "select *
> from atable where afield is null" will work.
> hth

Basically I'd like to get all records when the parameter is null, and
only filtered records when the parameter is not null. FIELD is never
null.

I'm trying to avoid dynamic dynamic or almost-duplicate query in the
application code.
>
> --
> Alan J Davies
> Aldis
>
> Quoting Harriv <harriv@...>:
>
> > I'm trying to do something like this:
> >
> > select * from TABLE
> > where FIELD = :param or :param is null
> >
> > When executing that, I get "Dynamic SQL Error SQL error code = -804 Data
> > type unknown" error. Should the above statement even be a possible?
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
>
>