DB2 Version 9.7 for Linux, UNIX, and Windows

concat function

The fn:concat function returns a string that is the concatenation of two or more atomic values.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-fn:concat(atomic-value,atomic-value-+---------------------+-)-><
                                       |    .-,------------. |     
                                       |    V              | |     
                                       '-,----atomic-value-+-'     

atomic-value
An atomic value or the empty sequence. If an argument is the empty sequence, the argument is treated as the zero-length string. If atomic-value is not an xs:string value, it is cast to xs:string before the values are concatenated.

Returned value

If all atomic-value arguments are the empty sequence, the returned value is a string of length 0. Otherwise, the returned value is the concatenation of the xs:string values that result from casting the atomic-value arguments to strings.

Example

The following function concatenates the strings 'ABC', 'ABD', the empty sequence, and 'ABE':

fn:concat('ABC', 'ABD', (), 'ABE')

The returned value is 'ABCABDABE'.