DB2 Version 9.7 for Linux, UNIX, and Windows

CONCAT scalar function

Read syntax diagramSkip visual syntax diagram
>>-CONCAT--(--expression1--,--expression2--)-------------------><

The schema is SYSIBM.

The CONCAT function combines two arguments to form a string expression.
expression1
An expression that returns a value of any string data type, any numeric data type, or any datetime data type.
expression2
An expression that returns a value of any string data type, any numeric data type, or any datetime data type. However, some data types are not supported in combination with the data type of expression1, as described below.
The arguments can be any combination of string (except binary string), numeric, and datetime values. When an argument is a non-string value, it is implicitly cast to VARCHAR. A binary string can only be concatenated with another binary string. However, through the castable process of function resolution, a binary string can be concatenated with a character string defined as FOR BIT DATA when the first argument is the binary string.

Concatenation involving both a character string argument and a graphic string argument is supported only in a Unicode database. The character argument is first converted to the graphic data type before the concatenation. Character strings defined as FOR BIT DATA cannot be cast to the graphic data type.

The result of the function is a string that consists of the first argument followed by the second argument. The data type and the length of the result is determined by the data types and lengths of the arguments, after any applicable casting is done. For more information, refer to the "Data Type and Length of Concatenated Operands" table in the "Expressions" topic.

If either argument can be null, the result can be null; if either argument is null, the result is the null value.

Notes

Example