I have a DW where I'm trying to retrieve some rows from a table called DONOR, with two retrieval args (MemberNumber int, Email String) with SQL like:
SELECT ...
FROM DONOR
JOIN ...
WHERE (member_number = :MemberNumber and :MemberNumber > 0) OR
(email = :Email and :Email > '')
If I pass in arguments 1 and NULL, it works correctly - selecting the donor with member_number = 1.
If I pass in arguments 0 and my email address (which definitely exists in the table!) I get no rows (and no error) if DisableBind is off, and the correct rows if DisableBind=1.
If I change the WHERE clause to:
WHERE member_number = :MemberNumber OR coalesce(email, 'zzz') = :Email
it works fine. (I added the coalesce so that donors with NULL in the email field weren't selected when NULL was passed for that retrieval arg!)
Any bright ideas what could be going on? This is in Firebird SQL. Thanks.