Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread NULL Parameter Returns No Records
Tue, Jun 29 2010 4:56 PMPermanent Link

Greg Bishop

As of EDB 2.03 Build 13 (I think), the following query returns zero records, even when records should be returned (as occurred in Build 12 and before).  I've narrowed it down to no records being returned when the value in :PrimaryTelephoneID is NULL.  If I update the NULL values to zero (which makes the TelephoneID = :PrimaryTelephyoneID always return FALSE), then I get the expected result, with records.  I suspect that it has something to do with Incident 3199.

Is my only recourse to revise the query to test for a NULL situation?  I'm currently on EDB 2.03 Build 15 Unicode.

=====================================
This does not work (as of Build 13??)
=====================================

SELECT TelephoneID, Description, Number,
 True AS Primary FROM Telephone
WHERE (TelephoneID IN
 (SELECT TelephoneID FROM ContactToTelephone
 WHERE ContactID = :ContactID))
 AND (TelephoneID = :PrimaryTelephoneID)
UNION
SELECT TelephoneID, Description, Number,
 False AS Primary FROM Telephone
WHERE (TelephoneID IN
 (SELECT TelephoneID FROM ContactToTelephone
 WHERE ContactID = :ContactID))
 AND (TelephoneID <> :PrimaryTelephoneID)

===================================
This works and does return records:
===================================

SELECT TelephoneID, Description, Number,
 True AS Primary FROM Telephone
WHERE (TelephoneID IN
 (SELECT TelephoneID FROM ContactToTelephone
 WHERE ContactID = :ContactID))
Sat, Jul 3 2010 10:30 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Greg,

<< As of EDB 2.03 Build 13 (I think), the following query returns zero
records, even when records should be returned (as occurred in Build 12 and
before).  I've narrowed it down to no records being returned when the value
in :PrimaryTelephoneID is NULL.  If I update the NULL values to zero (which
makes the TelephoneID = :PrimaryTelephyoneID always return FALSE), then I
get the expected result, with records.  I suspect that it has something to
do with Incident 3199. >>

Yes, that is correct.

<< Is my only recourse to revise the query to test for a NULL situation?
I'm currently on EDB 2.03 Build 15 Unicode. >>

Yes, you'll have to add an IS NULL test like this:

MyColumn=:MyParam OR ((:MyParam IS NULL) and (MyColumn IS NULL))

One of the enhancements that I hope to get into 2.04 is a new == operator
for testing for equality or similar NULLness in one shot.

--
Tim Young
Elevate Software
www.elevatesoft.com


Image