db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Fox (Resolved) (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (TORQUE-58) Where clause with zero length string should be converted to NULL if db is Oracle
Date Mon, 30 Jan 2012 18:32:10 GMT

     [ https://issues.apache.org/jira/browse/TORQUE-58?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Thomas Fox resolved TORQUE-58.

    Resolution: Won't Fix
      Assignee: Thomas Fox

This behaviour of oracle cannot be encapsulated in any sensible way. 
Consider adding the value "" into a database and then querying for the value null. Oracle
will find the row, and other databases will not find it.
The only way to be database independent would be to always consider "" as null, but then this
would remove the feature to distinguish between null and "" for other databases, and users
may depend on this feature.
> Where clause with zero length string should be converted to NULL if db is Oracle
> --------------------------------------------------------------------------------
>                 Key: TORQUE-58
>                 URL: https://issues.apache.org/jira/browse/TORQUE-58
>             Project: Torque
>          Issue Type: Bug
>          Components: Runtime
>    Affects Versions: 3.3
>         Environment: All OS, All Hardware, Oracle db
>            Reporter: parthasarathy
>            Assignee: Thomas Fox
> Oracle treats Zero length characters as NULL. Consider the following case 
> -- Table create --
> create table nullzero (field1 varchar2(10), field2 varchar2(10));
> -- Record insert --
> insert into nullzero('',null);
> -- Query --
> select * from nullzero where field1 = "" -- returns no rows
> select * from nullzero where field2 is null -- returns the inserted row
> select * from nullzero where field1 is null -- returns the inserted row.
> The first statement should have returned a record as we inserted "" for field1. But it
did not return a row as Oracle has converted the "" to NULL during insert. We cannot change
the where clause as we want the criteria to be db agnostic. For example the first statement
would have worked in other dbs. 
> We should handle this case in torque to change the where clause to NULL if it is "" (zero
length string) . One place where we can do this is at build() method of org.apache. torque.util.SQLExpression.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org

View raw message