Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 2 of 2 total |
NULL Parameter Returns No Records |
Tue, Jun 29 2010 4:56 PM | Permanent 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 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. 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 |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |