Subject Re: Query : Numeric NULL value in where clause - usage?
Author Svein Erling Tysvær
Hi Srini!

Null is a state and not a value - that has been repeated on this list
lots of times. To do what you are trying to do, you have to do

SQL> select * from A3 where DATA IN (2,1) or DATA IS NULL;

IS [NOT] NULL is the way to check for NULLs.

HTH,
Set

--- In firebird-support@yahoogroups.com, karthick srini wrote:
> Dear Members,
>
> I have an nullable numeric column having null values.
>
>
> Consider below query and out put ,
>
> QL> select * from A3;
>
> ID DATA STRD
> =========== ============ ==========
>
> 4 <null> kk
> 3 <null> <null>
> 2 2 bbb
> 1 1 aa
> 5 5 <null>
>
> SQL> show table a3;
> ID INTEGER Not Null
> DATA INTEGER Nullable
> STRD VARCHAR(10) Nullable
> CONSTRAINT INTEG_736:
> Primary key (ID)
>
>
> I like to select some data with 'IN' in where clause
> fro numeric column ,
> SQL> select * from A3 where DATA IN(2,1,NULL);
> Statement failed, SQLCODE = -104
>
> Dynamic SQL Error
> -SQL error code = -104
> -Token unknown - line 1, char 36
> -NULL
> SQL>
>
> I get an error as given above. If I give NULL with in
> quotes I get error
> -conversion error from string "NULL"
>
> Even below query fails,
> select * from A3 where DATA=(null);
>
> Please do help me , how to handle numeric NULL value
> in where clause.
>
> S.Karthick