Just one idea - I'm not using Oracle - but what about: (column = '' OR column IS NULL)
In Torque Criteria.Criterion c1 = criteria.getNewCriterion(COLUMN, "", Criteria.EQUAL); Criteria.Criterion c2 = criteria.getNewCriterion(COLUMN, (Object)null, Criteria.ISNULL); criteria.add(c1.or(c2)); ? Does this work in Oracle. In MySQL this isn't a problem. > -----Ursprüngliche Nachricht----- > Von: Parthasarathy Thandavarayan > [mailto:[EMAIL PROTECTED] > Gesendet: Dienstag, 3. Oktober 2006 06:18 > An: [email protected] > Betreff: Oracle - Null and Zero-length string problem > > > 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 > > > Thanks, > > Sarathy > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
