<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Oracle empty string = null</title>
	<atom:link href="http://www.thunderguy.com/semicolon/2003/04/26/oracle-empty-string-null/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thunderguy.com/semicolon/2003/04/26/oracle-empty-string-null/</link>
	<description>Software, the Internet and you.</description>
	<lastBuildDate>Mon, 15 Mar 2010 01:44:10 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Bennett</title>
		<link>http://www.thunderguy.com/semicolon/2003/04/26/oracle-empty-string-null/comment-page-2/#comment-103202</link>
		<dc:creator>Bennett</dc:creator>
		<pubDate>Sat, 20 Feb 2010 09:27:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.thunderguy.com/plusplus/20050422/oracle-empty-string-null/#comment-103202</guid>
		<description>@Fabio, you could try checking the length. Something like
&lt;code&gt;select * from tablename where 0 &lt; char_length(columnname)&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>@Fabio, you could try checking the length. Something like<br />
<code>select * from tablename where 0 < char_length(columnname)</code></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fabio</title>
		<link>http://www.thunderguy.com/semicolon/2003/04/26/oracle-empty-string-null/comment-page-2/#comment-103193</link>
		<dc:creator>Fabio</dc:creator>
		<pubDate>Sat, 20 Feb 2010 02:23:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.thunderguy.com/plusplus/20050422/oracle-empty-string-null/#comment-103193</guid>
		<description>Hi, 

I&#039;m trying to write a query that can run both on SQLSERVER and ORACLE.
For example, if one table have a field with null and &#039;&#039;, and I need only lines that have values, how can I do that?
IS NOT NULL works with oracle but dont work with sqlserver (the blank line is in the result)
If I put IS NOT NULL AND  &#039;&#039; oracle brigs no lines...
I&#039;m stuck!

Thanx for any help!</description>
		<content:encoded><![CDATA[<p>Hi, </p>
<p>I&#8217;m trying to write a query that can run both on SQLSERVER and ORACLE.<br />
For example, if one table have a field with null and &#8221;, and I need only lines that have values, how can I do that?<br />
IS NOT NULL works with oracle but dont work with sqlserver (the blank line is in the result)<br />
If I put IS NOT NULL AND  &#8221; oracle brigs no lines&#8230;<br />
I&#8217;m stuck!</p>
<p>Thanx for any help!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sampo Syreeni</title>
		<link>http://www.thunderguy.com/semicolon/2003/04/26/oracle-empty-string-null/comment-page-2/#comment-94358</link>
		<dc:creator>Sampo Syreeni</dc:creator>
		<pubDate>Wed, 19 Aug 2009 08:31:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.thunderguy.com/plusplus/20050422/oracle-empty-string-null/#comment-94358</guid>
		<description>One big problem with NULL==&#039;&#039; is that it totally breaks the closure rules for normal string operations. You suddenly can&#039;t be sure that e.g. a trim() or a substr() taken from a non-null is still non-null. That is a real pain if you try to do complex string processing.</description>
		<content:encoded><![CDATA[<p>One big problem with NULL==&#8221; is that it totally breaks the closure rules for normal string operations. You suddenly can&#8217;t be sure that e.g. a trim() or a substr() taken from a non-null is still non-null. That is a real pain if you try to do complex string processing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sharkb</title>
		<link>http://www.thunderguy.com/semicolon/2003/04/26/oracle-empty-string-null/comment-page-2/#comment-93971</link>
		<dc:creator>sharkb</dc:creator>
		<pubDate>Wed, 12 Aug 2009 00:36:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.thunderguy.com/plusplus/20050422/oracle-empty-string-null/#comment-93971</guid>
		<description>In the example above, the meaning of &#039;1&#039; is &quot;a range covering all phone numbers starting with &#039;1&#039; &quot;, and the meaning of &#039;&#039; is &quot;a range covering all phone numbers starting with &#039;&#039; &quot;, that is all possible numbers in the world. The reason for this concept is to calculate call rates depending on phone dialed. The empty string is used for all countries not included in the table, in case we didn&#039;t bother placing a price for a given country, or worse still if we failed to include some country. A null value would have a different meaning - &quot;skip this row, it&#039;s INVALID&quot;, while an empty string is perfectly valid and meaningfull.

Away from the specific interpretation, a string is the computer/lexical equivalent of the mathematical concept of tuple (ordered sequence). A 2-character string is the equivalent of 2-tuple. A 1-character string is the equivalent of 1-tuple. Well not really a string - it has just one character? Still, nobody rejects the concept of 1-character strings. Neither does mathematics. A 0-character (empty) string is the equivalent of 0-tuple - a completely valid mathematical object.

Another similar concept (both in IT/life and maths) is the concept of sets. The difference between a set and a tuple is that the set has no specific order of the elements. The similarity is that the set can have 0 elements too. It&#039;s a completely valid set, as is the 0-tuple and the empty string. Any operation specific to the object may by applied to the empty object, as it is comlpetely valid and meaningfull. In contrast, the NULL value has no meaning and is invalid by definition.</description>
		<content:encoded><![CDATA[<p>In the example above, the meaning of &#8216;1&#8242; is &#8220;a range covering all phone numbers starting with &#8216;1&#8242; &#8220;, and the meaning of &#8221; is &#8220;a range covering all phone numbers starting with &#8221; &#8220;, that is all possible numbers in the world. The reason for this concept is to calculate call rates depending on phone dialed. The empty string is used for all countries not included in the table, in case we didn&#8217;t bother placing a price for a given country, or worse still if we failed to include some country. A null value would have a different meaning &#8211; &#8220;skip this row, it&#8217;s INVALID&#8221;, while an empty string is perfectly valid and meaningfull.</p>
<p>Away from the specific interpretation, a string is the computer/lexical equivalent of the mathematical concept of tuple (ordered sequence). A 2-character string is the equivalent of 2-tuple. A 1-character string is the equivalent of 1-tuple. Well not really a string &#8211; it has just one character? Still, nobody rejects the concept of 1-character strings. Neither does mathematics. A 0-character (empty) string is the equivalent of 0-tuple &#8211; a completely valid mathematical object.</p>
<p>Another similar concept (both in IT/life and maths) is the concept of sets. The difference between a set and a tuple is that the set has no specific order of the elements. The similarity is that the set can have 0 elements too. It&#8217;s a completely valid set, as is the 0-tuple and the empty string. Any operation specific to the object may by applied to the empty object, as it is comlpetely valid and meaningfull. In contrast, the NULL value has no meaning and is invalid by definition.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sharkb</title>
		<link>http://www.thunderguy.com/semicolon/2003/04/26/oracle-empty-string-null/comment-page-1/#comment-93965</link>
		<dc:creator>sharkb</dc:creator>
		<pubDate>Tue, 11 Aug 2009 22:20:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.thunderguy.com/plusplus/20050422/oracle-empty-string-null/#comment-93965</guid>
		<description>Kamal,

Imagine a column containing phone prefixes, where &#039;1&#039; means North America, &#039;1212&#039; means Manhattan Area 212, and &#039;&#039; means ... (did you guess it?) the whole world. You may still want to have null in this column in case the prefix is (still) unknown, but that&#039;s not important. We need to use this value in order, length, compare and other expression as a valid and meaningfull value, which is certanly different from null аnд it behaviour.</description>
		<content:encoded><![CDATA[<p>Kamal,</p>
<p>Imagine a column containing phone prefixes, where &#8216;1&#8242; means North America, &#8216;1212&#8242; means Manhattan Area 212, and &#8221; means &#8230; (did you guess it?) the whole world. You may still want to have null in this column in case the prefix is (still) unknown, but that&#8217;s not important. We need to use this value in order, length, compare and other expression as a valid and meaningfull value, which is certanly different from null аnд it behaviour.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ant</title>
		<link>http://www.thunderguy.com/semicolon/2003/04/26/oracle-empty-string-null/comment-page-1/#comment-93399</link>
		<dc:creator>Ant</dc:creator>
		<pubDate>Fri, 31 Jul 2009 08:44:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.thunderguy.com/plusplus/20050422/oracle-empty-string-null/#comment-93399</guid>
		<description>I can&#039;t beleive I&#039;m here again...
I came across this problem 8 (yes, that&#039;s right EIGHT) years ago when I first tried to port our software to Oracle (I think at the time it was 8i or something).
I&#039;m now trying to port again, this time to 11g and its STILL a problem.
Now after all this time I was sure that Oracle would have sorted it - BUT NO - still the same problem. Trying to insert an empty string into a NOT NULL column results in &quot;ORA-01400: cannot insert NULL&quot; AAAArrrrrhhhhhh!!!! PLEASE, PLEASE, PLEASE, NO, NO, NO.
One word - crap.</description>
		<content:encoded><![CDATA[<p>I can&#8217;t beleive I&#8217;m here again&#8230;<br />
I came across this problem 8 (yes, that&#8217;s right EIGHT) years ago when I first tried to port our software to Oracle (I think at the time it was 8i or something).<br />
I&#8217;m now trying to port again, this time to 11g and its STILL a problem.<br />
Now after all this time I was sure that Oracle would have sorted it &#8211; BUT NO &#8211; still the same problem. Trying to insert an empty string into a NOT NULL column results in &#8220;ORA-01400: cannot insert NULL&#8221; AAAArrrrrhhhhhh!!!! PLEASE, PLEASE, PLEASE, NO, NO, NO.<br />
One word &#8211; crap.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mg</title>
		<link>http://www.thunderguy.com/semicolon/2003/04/26/oracle-empty-string-null/comment-page-1/#comment-93316</link>
		<dc:creator>mg</dc:creator>
		<pubDate>Wed, 29 Jul 2009 12:31:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.thunderguy.com/plusplus/20050422/oracle-empty-string-null/#comment-93316</guid>
		<description>I just got bitten in the rear by this. Trying to find records with blank (whitespace) non-null values in some fields, I thought of comparing the length of the field vs the length of the trimmed field:
WHERE length(field) &gt; 0 AND length(trim(field))  0 AND trim(field) is null
...which doesn&#039;t make a whole lot of sense outside of Oracle&#039;s little world of weird logic, but works.
So thanks, Bennett, for explaining, and thanks, Oracle, for nothing :P</description>
		<content:encoded><![CDATA[<p>I just got bitten in the rear by this. Trying to find records with blank (whitespace) non-null values in some fields, I thought of comparing the length of the field vs the length of the trimmed field:<br />
WHERE length(field) &gt; 0 AND length(trim(field))  0 AND trim(field) is null<br />
&#8230;which doesn&#8217;t make a whole lot of sense outside of Oracle&#8217;s little world of weird logic, but works.<br />
So thanks, Bennett, for explaining, and thanks, Oracle, for nothing <img src='http://www.thunderguy.com/semicolon/wp/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bennett</title>
		<link>http://www.thunderguy.com/semicolon/2003/04/26/oracle-empty-string-null/comment-page-1/#comment-92047</link>
		<dc:creator>Bennett</dc:creator>
		<pubDate>Tue, 23 Jun 2009 11:03:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.thunderguy.com/plusplus/20050422/oracle-empty-string-null/#comment-92047</guid>
		<description>And let&#039;s not forget that in Oracle,
&lt;blockquote&gt;The expression &lt;code&gt;&#039;&#039;=&#039;&#039;&lt;/code&gt; is not true.&lt;/blockquote&gt;
I would love to see anybody try to argue that this isn&#039;t nonsense.</description>
		<content:encoded><![CDATA[<p>And let&#8217;s not forget that in Oracle,</p>
<blockquote><p>The expression <code>''=''</code> is not true.</p></blockquote>
<p>I would love to see anybody try to argue that this isn&#8217;t nonsense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bennett</title>
		<link>http://www.thunderguy.com/semicolon/2003/04/26/oracle-empty-string-null/comment-page-1/#comment-92046</link>
		<dc:creator>Bennett</dc:creator>
		<pubDate>Tue, 23 Jun 2009 10:59:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.thunderguy.com/plusplus/20050422/oracle-empty-string-null/#comment-92046</guid>
		<description>@Kamal, I do think reliability and scalability are important. But they&#039;re also boring to me. I&#039;m glad that some people are interested in them though.

One of the more common uses of null is to indicate &quot;unknown&quot; as @Eric mentioned. &lt;code&gt;label=&#039;large&#039;&lt;/code&gt; means that the label is &quot;large&quot;, &lt;code&gt;label=&#039;&#039;&lt;/code&gt; means the label is blank, and &lt;code&gt;label=null&lt;/code&gt; means that we don&#039;t know. In Oracle you have to do this with an extra Boolean field.</description>
		<content:encoded><![CDATA[<p>@Kamal, I do think reliability and scalability are important. But they&#8217;re also boring to me. I&#8217;m glad that some people are interested in them though.</p>
<p>One of the more common uses of null is to indicate &#8220;unknown&#8221; as @Eric mentioned. <code>label='large'</code> means that the label is &#8220;large&#8221;, <code>label=''</code> means the label is blank, and <code>label=null</code> means that we don&#8217;t know. In Oracle you have to do this with an extra Boolean field.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kamal</title>
		<link>http://www.thunderguy.com/semicolon/2003/04/26/oracle-empty-string-null/comment-page-1/#comment-92028</link>
		<dc:creator>Kamal</dc:creator>
		<pubDate>Mon, 22 Jun 2009 17:22:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.thunderguy.com/plusplus/20050422/oracle-empty-string-null/#comment-92028</guid>
		<description>@Bennett: if you call reliability and scalability boring enterprise stuff I guess you never had valuable data on a db ;)
@Robert: NULLs don&#039;t blow up on Oracle, it didn&#039;t die on one NULL, it just considers &#039;&#039; as NULL, and an equality operator on a NULL is always false, it&#039;s like saying WHERE col = NULL. That will always be false.
You can also try WHERE &#039;&#039; = &#039;&#039; OR NULL = NULL, you won&#039;t have any results.

Anyway... I can&#039;t think of a proper use of &#039;&#039; instead of NULL. I know it&#039;s non standard but can you supply an example where this differentiation would be useful?
I guess most of its use comes from poorly sanitized input.

Cheers</description>
		<content:encoded><![CDATA[<p>@Bennett: if you call reliability and scalability boring enterprise stuff I guess you never had valuable data on a db <img src='http://www.thunderguy.com/semicolon/wp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
@Robert: NULLs don&#8217;t blow up on Oracle, it didn&#8217;t die on one NULL, it just considers &#8221; as NULL, and an equality operator on a NULL is always false, it&#8217;s like saying WHERE col = NULL. That will always be false.<br />
You can also try WHERE &#8221; = &#8221; OR NULL = NULL, you won&#8217;t have any results.</p>
<p>Anyway&#8230; I can&#8217;t think of a proper use of &#8221; instead of NULL. I know it&#8217;s non standard but can you supply an example where this differentiation would be useful?<br />
I guess most of its use comes from poorly sanitized input.</p>
<p>Cheers</p>
]]></content:encoded>
	</item>
</channel>
</rss>
