Hi Baruch, in such cases I use one of the following methods:
SELECT col1 FROM table1 WHERE col2=:val or (col2 is null and :val is null) SELECT col1 FROM table1 WHERE coalesce(col2, '#') = coalesce(:val, '#') where '#' is a value that i know is never used in col2 (this is a drawback) Yours Martin Am 05.11.2014 09:46, schrieb Baruch Burstein:
Hi all, This is not really a sqlite specific question, but I was wondering if there might be a sqlite specific answer. I prepare the following statement: "SELECT col1 FROM table1 WHERE col2=:val" col2 is a textual string, and may sometimes be NULL. If I bind a string to :val it works fine. If I bind a null-pointer the comparison fails since it should be using ISNULL. Is there a way to do this correctly with a single statement? I know I can have 2 statments and test the string pointer at runtime to determine which one to run, but that seems awkward.
_______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

