[ http://nagoya.apache.org/jira/browse/DERBY-7?page=comments#action_56977 ] Christian d'Heureuse commented on DERBY-7: ------------------------------------------
Sorry, ignore my previous comment. I had mistaken nullif() with isnull/coalesce(). The expression values nullif(1,1) should return the value cast(null as int) In sqlgrammar.jj there is the following comment: // "NULLIF(L, R)" is the same as "L=R ? CAST(NULL AS CHAR(1)) : L" I think the problem is: thenExpression = CAST(NULL AS CHAR(1)) = type CHAR elseExpression = L = type INT ==> CHAR and INT are not compatible. To solve this problem, the data type of L (leftExpression) could be used to build the NULL constant node, instead of CHAR(1). > Bug in NULLIF Function > ---------------------- > > Key: DERBY-7 > URL: http://nagoya.apache.org/jira/browse/DERBY-7 > Project: Derby > Type: Bug > Components: SQL > Versions: 10.0.2.0 > Reporter: Tulika Agrawal > Priority: Minor > > Reporting for Christian d'Heureuse, filed on derby-dev list. > The NULLIF built-in function of Cloudscape 10.0.1.0 beta seems to accept > only string values. > Examples: > values nullif('a','b'); > --> OK > values nullif(1,2); > --> Error message: "ERROR 42X89: Types 'CHAR' and > 'INTEGER' are not type compatible. (Neither type > is assignable to the other type.)" -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://nagoya.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira
