Le Saturday 27 October 2007 06:42:50 Manuel NAUDIN, vous avez écrit :

Hi Manu,

> a simple query "PROD_QUERY" created in sql mode with direct sql on :
> SELECT "id_prod", "prod_name" || ' ' || "prod_details" AS "product
> description" FROM "PRODUCTS"
>
> What is unexpected (to me at least) is that if the "prod_details"
> field is empty, "product_description" is empty too, although there's a
> string in the "prod_name" field.

Hmm, I think that this is normal SQL behaviour, if the second field contains 
NULL values (i.e. is empty) then the returned result of the concatenation is 
also empty. This is at least the case with MySQL and, if I've understood 
correctly Oracle too.

http://www.oracle.com/technology/products/jdev/esdk/api1013/oracle/javatools/util/ModelUtil.html

concat
public static final java.lang.String concat(java.lang.String[] strs,
                                            java.lang.String delim)

    Returns a single string that is the concatenation of all the strings in 
the specified string array. The strings are separated by the specified 
delimiter. Null array elements are skipped. If the array itself is null, the 
empty string is returned. This method is guaranteed to return a non-null 
value, if no expections are thrown.

http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat
 CONCAT() returns NULL if any argument is NULL.




Alex

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to