Hi all,

The problem seems to be that sqlite makes a difference between an empty string and a null value.
Therefore, your query has to check both.
In Oracle (and problaby others) the datatype "Varchar2" can be used to treat an empty string as a null value.
Does anyone know if there is a way to do this in sqlite?

Martin

Eggert, Henri schrieb:

Sorry , I was not clear enough.

Considere the following :

create table t1 ( a integer , b text , c text ) ;
insert into t1 ( a , b , c ) values ( 1 , 'a' , 'b' ) ;
insert into t1 ( a , b , c ) values ( 2 , 'c' , ''  ) ;
insert into t1 ( a , b , c ) values ( 3 , ''  , 'd' ) ;
insert into t1 ( a , b , c ) values ( 4 , ''  , ''  ) ;
insert into t1 ( a , b     ) values ( 5 , 'e'       ) ;
insert into t1 ( a ,     c ) values ( 6       , 'f' ) ;
insert into t1 ( a         ) values ( 7             ) ;
select a from t1 where ( b ='' and c = '' )

This returns 4 ( b and c have explicitely been set to empty string )
But not 7 ( b and c not set but also empty ).

What I need is a select statement which returns both.

Regards , Henri


By the way :

Sqlite is a great piece of software.
Thank you drh.

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 18. Oktober 2005 20:05
An: sqlite-users@sqlite.org
Betreff: Re: [sqlite] and , or

"Eggert, Henri" <[EMAIL PROTECTED]> wrote:
Hi sqlite-users

Works fine : select Id from Data where ( ( Text = '' ) or ( Comming = ''
) )
But NOT    : select Id from Data where ( ( Text = '' ) and ( Comming =
'' ) )


Both work fine when I try them.  Why do you think the second one
is not working?

--
D. Richard Hipp <[EMAIL PROTECTED]>

Reply via email to