Author: tfischer
Date: Sun Oct  8 02:44:40 2006
New Revision: 454111

URL: http://svn.apache.org/viewvc?view=rev&rev=454111
Log:
Added a section about Oracle's treatment of empty strings.
Thanks to Parthasarathy Thandavarayan for reporting the problem and to Thoralf 
Rickert to provide a workaround.

Modified:
    db/torque/site/trunk/xdocs/version-specific/database-howtos/oracle-howto.xml

Modified: 
db/torque/site/trunk/xdocs/version-specific/database-howtos/oracle-howto.xml
URL: 
http://svn.apache.org/viewvc/db/torque/site/trunk/xdocs/version-specific/database-howtos/oracle-howto.xml?view=diff&rev=454111&r1=454110&r2=454111
==============================================================================
--- 
db/torque/site/trunk/xdocs/version-specific/database-howtos/oracle-howto.xml 
(original)
+++ 
db/torque/site/trunk/xdocs/version-specific/database-howtos/oracle-howto.xml 
Sun Oct  8 02:44:40 2006
@@ -48,6 +48,25 @@
       instead which gives you millisecond accuracy.
     </p>
 
+    <p>
+      Oracle does not distinguish between empty strings and null strings.
+      If an empty string is inserted into a table, it will be treated as null.
+      If you want to re-read this column by selecting records which contain
+      an empty string, oracle will return no columns. The only way to select
+      the column is to query for records which contain null in that column.
+      <br/>
+      This behaviour is different in most other databases. So if you
+      want to write code which works for other databases and oracle, you need
+      to consider both cases - the column might be null and it might contain
+      an empty string. For example:
+    </p>
+
+<source>
+Criteria.Criterion c1 = criteria.getNewCriterion(COLUMN, "", Criteria.EQUAL);
+Criteria.Criterion c2 = criteria.getNewCriterion(COLUMN, (Object)null, 
Criteria.ISNULL);
+criteria.add(c1.or(c2));
+</source>
+
     <subsection name="Oracle versions">
       <p>
         This version of Torque is optimized for Oracle 9i and later.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to