Subject Re: [firebird-support] Problem with query parameter
Author Harriv
On Tue, Mar 10, 2009 at 5:24 PM, Svein Erling Tysvær
<svein.erling.tysvaer@...> wrote:
> A workaround would be
>
> select * from TABLE
> where FIELD = coalesce(:param, FIELD)
>
> This will never use any index, but there's no way to use indexes with WHERE
> clauses like this anyway.

Thanks, this will do it.

For those who are concerned about performance, the actual query is
more complex and the whole table is not returned ever. I just created
smallest possible test case I could find. This additional "filter" is
for handling some outlier cases.


>
> HTH,
> Set
>
> -----Original Message-----
> From: firebird-support@yahoogroups.com
> [mailto:firebird-support@yahoogroups.com] On Behalf Of Harriv
> Sent: 10. mars 2009 15:46
> To: firebird-support@yahoogroups.com
> Subject: [firebird-support] Problem with query parameter
>
> 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]
>