Concatenation
The concatenation operator (CONCAT) joins two values of
an expression into a single string. The alternate operator for CONCAT
is ||. Because vertical bars can cause parsing errors in statements
passed from one DBMS to another, CONCAT is the preferred operator
for statements executed at remote locations.
The concatenation operator observes the following rules:
- The operands of a concatenation operator must both be character
strings or both be graphic strings.
- The length of the result is the sum of the lengths of the operands.
- The data type of the result is:
- VARCHAR when one or more operands is VARCHAR
- CHAR when both operands are CHAR
- VARGRAPHIC when one or more operands are VARGRAPHIC
- GRAPHIC when both operands are GRAPHIC
- If either operand is a null value, the result is the null value.
For example:
VALUE(FNAME, 'unknown') CONCAT VALUE(LNAME, 'unknown')
To avoid a null value, use the VALUE function. For more information
on VALUE, see String functions.
- Concatenation cannot be specified in a LIKE clause, nor in the
SET clause of an UPDATE statement.
