Received: from sol.openu.ac.il (mta@sol.openu.ac.il [147.233.32.35]) by hub.org (8.9.1/8.9.1) with ESMTP id EAA28816 for ; Wed, 23 Dec 1998 04:36:14 -0500 (EST) (envelope-from herouth@oumail.openu.ac.il) Received: from talmon.openu.ac.il ([147.233.32.11]) by sol.openu.ac.il (Netscape Messaging Server 3.54) with ESMTP id AAA1065 for ; Wed, 23 Dec 1998 11:37:21 +0200 Received: from [147.233.159.109] (mac-herouth.pc.openu.ac.il) by talmon.openu.ac.il (Netscape Messaging Server 3.54) with ESMTP id AAA756; Wed, 23 Dec 1998 11:36:24 +0200 X-Sender: herouth@shaked.cc.openu.ac.il Message-Id: In-Reply-To: <3680B749.3B30CF42@neptune.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Wed, 23 Dec 1998 11:37:44 +0200 To: darold From: Herouth Maoz Subject: Re: [GENERAL] PB with Null string Cc: pgsql-sql@postgreSQL.org (Redirected to the SQL list): At 11:26 +0200 on 23/12/98, darold wrote: > I have tried this query to check if a field is empty: > > SELECT * FROM t_table WHERE s_string=''; > > where s_string is declared as text. But this doesn't work, why? Is > there's an > other way to do that ? I have also tried with NULL but I think it is not > included > in the 6.3.2... There is a difference between the empty string and NULL. NULL means there is no value in the field. The empty string means there is a value, and this value is ''. To check for nulls, you don't write s_string=NULL. This, unfortunately, doesn't work in Postgres, because two NULLs are not considered equal. What you should do is s_string IS NULL: SELECT * FROM t_table WHERE s_string IS NULL; Herouth -- Herouth Maoz, Internet developer. Open University of Israel - Telem project http://telem.openu.ac.il/~herutma