What value will be returned if one of the string expressions contains a NULL value in the CONCAT function?

~ 0 min
2016-03-07 10:11

What value will be returned depends a setting which syntax is

     SET CONCAT NULL RETURN { NULL | STRING }

This option is used for string concatenation with null for the CONCAT built-in function or concatenate operator (||).

The default setting for this option is NULL. If this option is set to NULL, then any string concatenated with a null value will return null.

If the option is set to STRING, then any string concatenated with a null value will return the string, because the null value will be treated as an empty string.

For example:

dmSQL> select concat ('aaa', null);

                    CONCAT ('AAA', NULL)                              

===================================================================

NULL                            

1 rows selected

dmSQL> set concat null return string;

dmSQL> select concat ('aaa', null);

               CONCAT ('AAA', NULL)                              

===================================================================

aaa                                                                  

1 rows selected

Average rating 0 (0 Votes)

You cannot comment on this entry

Tags