db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dag.Wan...@Sun.COM (Dag H. Wanvik)
Subject Re: [jira] Updated: (DERBY-1904) COALESCE with NULL parameter problem
Date Mon, 02 Oct 2006 14:37:02 GMT


Hi,

"Cédric Gérard (JIRA)" <derby-dev@db.apache.org> writes:

> ij version 10.1
> ij> connect 'jdbc:derby://localhost:1528/watDB_v2';
> ij> SELECT ID_ITM, ITM_CODE FROM ITEMS WHERE ITM_CODE = COALESCE(NULL, ITM_CODE);
> ERROR 42X01: Syntax error: Encountered "NULL" at line 1, column 62.

The "NULL" literal here is not legal SQL, you need to cast the value
as in your next example.

> ij> SELECT ID_ITM, ITM_CODE FROM ITEMS WHERE ITM_CODE = COALESCE(CAST(NULL AS BIGINT),
ITM_CODE);
> ID_ITM              |ITM_CODE
> ---------------------------------------------
> ERROR 38000: The exception 'java.lang.NullPointerException' was thrown while evaluating
an expression. SQLSTATE: XJ001:
> Java exception: ': java.lang.NullPointerException'.

I tried this on trunk and it works for me. It may be that this has
been corrected already. Are you able to try it with the 10.2 release
candidate? You can find it here:
http://people.apache.org/~rhillegas/10.2.1.5/

Dag

Mime
View raw message