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 -> how to tell the difference between NULL and an empty string?

how to tell the difference between NULL and an empty string?

From: Patrick Joyal <please.reply_at_to.the.newsgroup>
Date: Mon, 13 Mar 2000 20:18:13 GMT
Message-ID: <38cd4f04@news>

Here's an excerpt of the Oracle documentation

"Oracle currently treats a character value with a length of zero as null. However, this
may not continue to be true in future releases, and Oracle recommends that you do not treat empty strings the same as NULLs"

How can I not treat empty strings the same as NULLs when the only way to select only those records with zero-length string is by checking if they're null :

   Select * from testTable where myString is null ; --> fetch rows where myString = ''

   Select * from testTable Where myString = '' ; --> fetch nothing

   Select * from testTable where trim (myString) = '' ; --> fetch nothing

   Select * from testTable where myString is not null ; --> fetch rows where mystring <> ''

   Select * from testTable where mystring <> '' ; --> fetch nothing

   Select * from testTable where myString <> '' and myString is not null
--> fetch nothing, but should fetch

rows with non-zero-length strings

So, apparently, there's no way to tell the difference between '' and null, but Oracle recommends that you consider it different, but how?

thanks

Patrick Received on Mon Mar 13 2000 - 14:18:13 CST

Original text of this message

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