Subject Re: [firebird-support] Order of operations - AND boolean operator
Author Koenraad Lelong
On 03-10-12 22:30, Rick Debay wrote:
> The field f.ID is alphanumeric, it can contain many types of data and
> the data type is described by f.ID_QUALIFIER .
> The problem is that Firebird is always evaluating "f.ID =" which throws
> an exception when f.ID contains non-numeric characters and b.ID_TYPE_*
> is numeric.
>
> FROM FOO f
> JOIN BAR b ON
> ((f.ID_QUALIFIER = 1) AND f.ID = b.ID_TYPE_1) OR
> ((f.ID_QUALIFIER = 2) AND f.ID = b.ID_TYPE_2
>
Hi,

I could be way off, but is that query a litteral copy of your actual
query ? Is so, would enclosing your type-checks between brackets solve
your problem ?
> ((f.ID_QUALIFIER = 1) AND (f.ID = b.ID_TYPE_1)) OR
> ((f.ID_QUALIFIER = 2) AND (f.ID = b.ID_TYPE_2))

Regards,

Koenraad Lelong.