Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: confused on "where x=null"...

Re: confused on "where x=null"...

From: Thorsten Kettner <thorsten.kettner_at_web.de>
Date: 5 Mar 2007 01:54:33 -0800
Message-ID: <1173088473.511515.210830@8g2000cwh.googlegroups.com>


On 3 Mrz., 00:49, Mark Harrison <m..._at_pixar.com> wrote:
> It also does not match any rows where x is null.
> Likewise, "where x=''" will not match any string
> column.

Your question about x=NULL has already been answered. So this is just some additional info: Unlike in SQL standard empty strings are NULL in Oracle. And with every release Oracle warns us that this may change in some future release and one should prepare one's statements for this. That means in Oracle you would never write <where str1 = str2>, but <where str1 = str2 or (str1 is null and str2 is null)> if one of the strings can be empty. You would also never write <where x="">, but <where x='' or x is null> or something alike. In Oracle SQL you must be very careful with string comparision and string function results, for example length(emptystring) is NULL, not zero as one would expect. Received on Mon Mar 05 2007 - 03:54:33 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US