Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle NULL vs '' revisited
William Robertson wrote:
> On Aug 27, 9:05 am, "Martin T." <0xCDCDC..._at_gmx.at> wrote:
>> DA Morgan wrote: >>> William Robertson wrote: >>>> On Aug 26, 2:17 pm, Frank van Bortel <frank.van.bor..._at_gmail.com> >>>> wrote: >>>>> NULL <> NULL, but '' = '', if that would help. >>>>> The length of NULL is NULL again. >>>> If we had a '' in Oracle then its length would be 0, but we don't, >>>> which is the subject of this thread. I was hoping someone could >>>> provide an example of non-null '' being a useful value. >>> You won't find one. What you will find is that people who have it >>> as an option create designs that use it. Those that don't have it >>> as an option don't. In the end you only have three values, NULL, 0 >>> and > 0. There are a nearly unlimited ways to code this in any >>> language and in any tool. >> I think you are right in that you can design both ways and I also think >> that it is probably really hard to find a case where '' means anything >> useful different from NULL from a semantic point of view. >> >> However, the point is was trying to make in my posts was that most >> systems/programming languages make the distinction and in general string >> processing the distinction is also very useful ( LENGTH(A+B) === >> LENGTH(A) + LENGTH(B) ). >> So the behavior of Oracle just makes the usage more complicated and >> error prone, imho. >> >> br, >> Martin
Of course NULLs are a fact. But I think a column with NOT NULL is often acceptable.
While we are at Java*, lets assume this very-pseudo code here:
--- String str = "hello"; int len = 0; str.substr(0, len); JDBC.insert("MY_VARCHAR_COL", str); ... String strx = JDBC.select("MY_VARCHAR_COLUMN"); // And now, because it's oracle, we do NOT get a String object with len 0, but we get a null. So we have to program around orcacle's varchar if(strx == null) { strx = new string(); } --- Since most of the languages used to get data out of Oracle make the distinction of NULL/null/undefined vs. '' so should oracle. It would make working with VARCHAR2 columns easier I think. br, MartinReceived on Mon Aug 27 2007 - 05:58:19 CDT
![]() |
![]() |