Re: Differentiate Between Zero-Length String and NULLColumn Values

From: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
To: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Differentiate Between Zero-Length String and NULLColumn Values
Date: 2007-01-30 16:38:34
Message-ID: 20070130113834.fa8d09e0.darcy@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, 30 Jan 2007 09:23:32 -0500
Andrew Sullivan <ajs(at)crankycanuck(dot)ca> wrote:
> Hmm. Well, I'm not an Oracle guy, so I don't really know. All I
> know is that we occasionally get people coming from Oracle who are
> surprised by this difference. What I've been _told_ is that '' and
> NULL are under some circumstances (maybe integers?) the same thing,
> whereas of course ' ' and NULL are not. But since I'm not an Oracle
> user, people should feel free to ignore me :)

I don't have an Oracle installation here and I haven't used it much but
I wonder if they treat the following two statements differently.

SELECT * FROM table WHERE column IS NULL;
SELECT * FROM table WHERE column = NULL;

The latter violates the SQL spec and is not allowed by PostgreSQL
without setting a special flag. Is it possible that Oracle accepts "="
against NULL and also treats it slightly differently?

--
D'Arcy J.M. Cain <darcy(at)druid(dot)net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Sullivan 2007-01-30 16:55:03 Re: Differentiate Between Zero-Length String and NULLColumn Values
Previous Message Ezequias Rodrigues da Rocha 2007-01-30 15:36:21 Linked Databases