db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Parthasarathy Thandavarayan" <Parthasarathy.Thandavara...@sos.sungard.com>
Subject Oracle - Null and Zero-length string problem
Date Tue, 03 Oct 2006 04:18:16 GMT
Hi all,

I am working on an framework that uses torque 3.2 as the ORM layer. Everything works perfectly
on MySQL 4.1 and I am right now trying to make it work on Oracle 10g also. One of the problems
i am facing is with respect to the difference in the way oracle handles zero-length strings
('') when compared to other dbs. In oracle zero-length strings are treated as null. If we
are inserting '' in a column and query it back with where clause --> where <column>
= ''  no rows will be returned. We should rather query it with the where clause --> where
<column> is null. 
On other dbs for eg., MySQL 4.1 the where clause condition should be --> where <column>
= ''. 

If I change the where clause to IS NULL then the app wont work on MySQL.. If I retain it as
'' then it wont work on Oracle.
Can anyone help me with a solution or workaround for this? 

One possible way to make it work is by changing the SQLExpression class to convert the criteria
to null from '' if the db is oracle. Is there anyother way to make this work? the only restriction
is that the same where clause should work on all dbs




  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message