Skip site navigation (1) Skip section navigation (2)

Re: Null not equal to '' (empty)

From: "Ries van Twisk" <ries(at)jongert(dot)nl>
To: "'Ajit Aranha'" <ajit_aranha(at)rocketmail(dot)com>,<pgsql-sql(at)postgresql(dot)org>
Subject: Re: Null not equal to '' (empty)
Date: 2002-09-27 12:40:06
Message-ID: 000001c26623$02f515a0$f100000a@IT001 (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
This is because '' is not equal to NULL

'' Means a empty string
NULL means a empty set

So this: SELECT * FROM tbl WHERE c1 IS NULL; 
is totally different then: SELECT * FROM tbl WHERE c1='';


-----Oorspronkelijk bericht-----
Van: pgsql-sql-owner(at)postgresql(dot)org
[mailto:pgsql-sql-owner(at)postgresql(dot)org]Namens Ajit Aranha
Verzonden: vrijdag 20 september 2002 8:09
Aan: pgsql-sql(at)postgresql(dot)org
Onderwerp: [SQL] Null not equal to '' (empty)

 Why is ''(empty) not equal to null? Its a major headache when porting
from other RDBMS like Oracle. Anyone knows any easy workarounds?
i.e. if you use:    create table tbl (
                         c1 varchar(5));

		 insert into tbl values ('');

                      select * from tbl where c1 is null;  will return
zero rows.

                  Also try this: select  TO_DATE('','DD-MM-YY');  and
this  TO_DATE('','DD-Mon-YY');
-Ajit (ajit_aranha(at)rocketmail(dot)com)

Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

In response to

pgsql-sql by date

Next:From: Richard HuxtonDate: 2002-09-27 12:54:54
Subject: Re: Dublicates pairs in a table.
Previous:From: Richard HuxtonDate: 2002-09-27 12:36:03
Subject: Re: Null not equal to '' (empty)

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group