<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Oracle LeerString == NULL</title>
    <link>http://forum.geizhals.at/feed.jsp?id=583354</link>
    <description>Geizhals-Forum</description>
    <item>
      <title>Re(5): Oracle LeerString == NULL</title>
      <link>http://forum.geizhals.at/t583354,4943226.html#4943226</link>
      <description>&lt;blockquote&gt;&lt;em&gt; Naja, blöd ist halt wenn da ~ drinnen steht.&lt;br&gt;&lt;/em&gt;&lt;/blockquote&gt;&lt;br&gt;steht eh nicht drin - war ja nur ein beispiel ... &lt;img src="zwinker.gif" width="16" height="19" align="absmiddle" alt=";-)"/&gt;&lt;br/&gt;</description>
      <pubDate>Sun, 03 Aug 2008 15:17:15 GMT</pubDate>
      <guid>http://forum.geizhals.at/t583354,4943226.html#4943226</guid>
      <dc:creator>jowahl</dc:creator>
      <dc:date>2008-08-03T15:17:15Z</dc:date>
    </item>
    <item>
      <title>Re(4): Oracle LeerString == NULL</title>
      <link>http://forum.geizhals.at/t583354,4943084.html#4943084</link>
      <description>Naja, blöd ist halt wenn da ~ drinnen steht.&lt;br/&gt;</description>
      <pubDate>Sun, 03 Aug 2008 12:49:03 GMT</pubDate>
      <guid>http://forum.geizhals.at/t583354,4943084.html#4943084</guid>
      <dc:creator>thE</dc:creator>
      <dc:date>2008-08-03T12:49:03Z</dc:date>
    </item>
    <item>
      <title>Re(3): Oracle LeerString == NULL</title>
      <link>http://forum.geizhals.at/t583354,4942355.html#4942355</link>
      <description>&lt;blockquote&gt;&lt;em&gt; Achja die Abfrage NVL(spalte,chr(0)) bringt etwas zurück was nicht null ist,&lt;br&gt;aber auch nicht mit = '' klappt. &lt;br&gt;&lt;/em&gt;&lt;/blockquote&gt;&lt;br&gt;musst halt auf beiden seiten mit NVL() vergleichen:&lt;br&gt;&lt;br&gt;...&lt;br&gt;WHERE NVL(a.spalte, '~') = NVL(b.spalte, '~')&lt;br&gt;...&lt;br/&gt;</description>
      <pubDate>Sat, 02 Aug 2008 14:53:27 GMT</pubDate>
      <guid>http://forum.geizhals.at/t583354,4942355.html#4942355</guid>
      <dc:creator>jowahl</dc:creator>
      <dc:date>2008-08-02T14:53:27Z</dc:date>
    </item>
    <item>
      <title>Re(2): Oracle LeerString == NULL</title>
      <link>http://forum.geizhals.at/t583354,4926340.html#4926340</link>
      <description>Naja, Problem ist, dass eine externe Firma eine Tabelle in unser DB System bekommt. Also eine Spiegelung von ihrer Tabelle aus einer Pervasive DB.&lt;br&gt;&lt;br&gt;Nur die haben dort 5 Spalten zu einem Primary Key zusammengefasst und immer bei mind 1. (max 2) Spalte(n) einen Leerstring.&lt;br&gt;Leider ist der jetzt bei Oracle NULL und beim Join haut dann where a.ckey2 = b.ckey2 nicht hin, weil null = null nicht geht.&lt;br&gt;Und da das ein automatisches System ist das ziemlich blöd so eine Ausnahmesituation einzubauen..&lt;br&gt;&lt;br&gt;Naja, werde mit der externen Firma verhandeln das die das Feld bei uns wenn es Leer ist mit einem Space versorgen und beim Zurückspiegeln müssen sie das halt rausnehmen.&lt;br&gt;&lt;br&gt;Achja die Abfrage NVL(spalte,chr(0)) bringt etwas zurück was nicht null ist, aber auch nicht mit = '' klappt. &lt;br/&gt;</description>
      <pubDate>Wed, 23 Jul 2008 20:12:08 GMT</pubDate>
      <guid>http://forum.geizhals.at/t583354,4926340.html#4926340</guid>
      <dc:creator>thE</dc:creator>
      <dc:date>2008-07-23T20:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle LeerString == NULL</title>
      <link>http://forum.geizhals.at/t583354,4925778.html#4925778</link>
      <description>Ist in Oracle 10.2.0.2.0 immer noch so. Hängt damit zusammen, dass Oracle NULL genauso wie Leerstrings abspeichert. &lt;br&gt;&lt;br&gt;Musst also deine Anwendung anpassen - obwohl mir jetzt kein Anwendungskontext einfallen würde, wo das semantisch einen Unterschied machen würde. &lt;br&gt;&lt;br&gt;Hier noch ein Auszug aus Note 451.1&lt;br&gt;&lt;br&gt;&lt;blockquote&gt;&lt;br&gt;Problem:&lt;br&gt;--------&lt;br&gt;How to retrieve a row with a select which compares a column to a empty string&lt;br&gt;&lt;br&gt;Solution:&lt;br&gt;---------&lt;br&gt;&lt;br&gt;This article will explain how null values can be evaluated with host&lt;br&gt;variables.&amp;nbsp;&amp;nbsp;Consider the following scenario.&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;o First, I want to insert a string:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;INSERT INTO DEPT(DEPTNO, DNAME) VALUES (99, :my_string);&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;o Then, I want to retrieve that same row:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SELECT DEPTNO INTO :my_dno FROM DEPT WHERE DNAME = :my_string;&lt;br&gt;&lt;br&gt;If my_string is a zero length (empty) string during the INSERT, a NULL&lt;br&gt;will be inserted into DNAME.&amp;nbsp;&amp;nbsp;Consequently, the SELECT with the&lt;br&gt;comparison "DNAME = :my_string" will not return the row.&amp;nbsp;&amp;nbsp;The reason&lt;br&gt;is that a NULL value does NOT equal another NULL value.&amp;nbsp;&amp;nbsp;Since a NULL&lt;br&gt;represents a lack of data, a null value cannot be either equal or&lt;br&gt;unequal to any other value, even another NULL.&amp;nbsp;&amp;nbsp;The only comparison&lt;br&gt;operators to use with null values are IS NULL and IS NOT NULL.&lt;br&gt;&lt;br&gt;How can we work around this?&amp;nbsp;&amp;nbsp;There are at least four ways:&lt;br&gt;&lt;br&gt;1)&amp;nbsp;&amp;nbsp;Use a special string to signify a zero length string.&amp;nbsp;&amp;nbsp;For&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;example,&amp;nbsp;&amp;nbsp;use "empty" to signify that the string is zero length.&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;This can be an awkward solution, since your application has to&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;to treat the string "empty" specially.&lt;br&gt;&lt;br&gt;2)&amp;nbsp;&amp;nbsp;Check to see if the string is zero length.&amp;nbsp;&amp;nbsp;If it is, do a&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT .. WHERE DNAME IS NULL;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;otherwise do a&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT .. WHERE DNAME = :my_string;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;This can be cumbersome, because if you reference multiple columns&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(say 6 columns) in your WHERE clause and each one might have a&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NULL value, then you would need 2^6 different statements.&amp;nbsp;&amp;nbsp;That&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;is 64 different WHERE clauses.&lt;br&gt;&lt;br&gt;3)&amp;nbsp;&amp;nbsp;Use the NVL function.&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT .. WHERE nvl(DNAME, 'empty') = nvl(:my_string,'empty');&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Any function in a SQL statement will supress the use of available&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;indexes.&amp;nbsp;&amp;nbsp;If your table is indexed, using NVL here may impact&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;performance.&amp;nbsp;&amp;nbsp;This solution is viable for applications that don't&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;need indexes.&lt;br&gt;&lt;br&gt;4)&amp;nbsp;&amp;nbsp;Use the straight forward method.&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SELECT .. WHERE ( (:my_string IS NULL AND DNAME IS NULL) OR&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(DNAME = :my_string) )&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Again, indexes cannot be used with either IS NULL or IS NOT NULL&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;phrase.&lt;br&gt;&lt;br&gt;There may be other solutions for evaluating nulls, but those mentioned&lt;br&gt;here should be sufficient.&lt;br&gt;&lt;br&gt;&lt;/blockquote&gt;&lt;br/&gt;</description>
      <pubDate>Wed, 23 Jul 2008 15:08:19 GMT</pubDate>
      <guid>http://forum.geizhals.at/t583354,4925778.html#4925778</guid>
      <dc:creator>ruprecht69</dc:creator>
      <dc:date>2008-07-23T15:08:19Z</dc:date>
    </item>
    <item>
      <title>Re(2): Oracle LeerString == NULL</title>
      <link>http://forum.geizhals.at/t583354,4925040.html#4925040</link>
      <description>Tjo, ist es aber!&lt;br&gt;&lt;br&gt;Es gibt "angeblich" einen Bugfix. Nur Oracle ist nicht fähig mir mein PW mitzuteilen. Ich warte schon 1 Stunde drauf...&lt;br&gt;&lt;br&gt;&lt;a href="https://startpage.com/do/search?hl=de&amp;q=oracle+empty+string+as+null&amp;btnG=Suche&amp;meta=" rel="noopener" target="_blank"&gt;https:/&lt;wbr/&gt;/&lt;wbr/&gt;startpage.com/&lt;wbr/&gt;do/&lt;wbr/&gt;search?&lt;wbr/&gt;hl=de&amp;&lt;wbr/&gt;q=oracle+empty+string+as+null&amp;&lt;wbr/&gt;btnG=Suche&amp;&lt;wbr/&gt;meta=&lt;/a&gt; &lt;br/&gt;</description>
      <pubDate>Wed, 23 Jul 2008 09:56:05 GMT</pubDate>
      <guid>http://forum.geizhals.at/t583354,4925040.html#4925040</guid>
      <dc:creator>thE</dc:creator>
      <dc:date>2008-07-23T09:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle LeerString == NULL</title>
      <link>http://forum.geizhals.at/t583354,4925026.html#4925026</link>
      <description>&gt;Da ja Oracle seit 8.0i oder so Leerstrings genauso behandelt wie NULL values,&lt;br&gt;&lt;br&gt;das wäre/ist aber ein ziemlich kurioser rückschritt...&lt;br&gt;&lt;br&gt;&lt;img src="frage.gif" width="16" height="26" align="absmiddle" alt="?-)"/&gt;&lt;br/&gt;</description>
      <pubDate>Wed, 23 Jul 2008 09:50:02 GMT</pubDate>
      <guid>http://forum.geizhals.at/t583354,4925026.html#4925026</guid>
      <dc:creator>adhoc</dc:creator>
      <dc:date>2008-07-23T09:50:02Z</dc:date>
    </item>
    <item>
      <title>Oracle LeerString == NULL</title>
      <link>http://forum.geizhals.at/t583354,4924814.html#4924814</link>
      <description>Da ja Oracle seit 8.0i oder so Leerstrings genauso behandelt wie NULL values, würde ich gerne wissen ob man das ausschalten kann.&lt;br&gt;&lt;br&gt;Ich will das Leerstrings halt auch leerstrings sind!&lt;br&gt;&lt;br&gt;Lustig ist ja das selbst beim NVL(value,'') wieder NULL zurückkommt, da ja ein LeerString wieder NULL ist.&lt;br&gt;&lt;br&gt;&lt;br&gt;Jedenfalls kann man das irgendwie abschalten? Weiß da jemand etwas? Habe per google nichts gefunden (außer das sich jeder über dieses Verhalten aufregt).&lt;br&gt;&lt;br&gt;&lt;br&gt;mfg&lt;br/&gt;</description>
      <pubDate>Wed, 23 Jul 2008 08:35:02 GMT</pubDate>
      <guid>http://forum.geizhals.at/t583354,4924814.html#4924814</guid>
      <dc:creator>thE</dc:creator>
      <dc:date>2008-07-23T08:35:02Z</dc:date>
    </item>
  </channel>
</rss>
