Previous Topic: Expressions without Arithmetic OperatorsNext Topic: Expressions with Arithmetic Operators


Expressions with the Concatenation Operator

The concatenation operator is represented by two vertical lines (||) or by CONCAT. If the concatenation operator is used in an expression, the result of the expression is a character string. The operands of concatenation must be character strings.

If either operand can be null, the result of the expression can be null. If either operand is null, the result of the expression is the null value. The result otherwise consists of the first operand character string followed by the second operand character string. The length of the result character string is the sum of the lengths of the operand strings.

In a concatenation, if any operand is MIXED, the result of the expression is MIXED. When concatenating a MIXED string ending with Shift-In with a MIXED string beginning with Shift-Out, both Shift characters are omitted in the result.

Note: For more information on MIXED data, see the CA Datacom/DB SQL User Guide.

Following is an example of using a concatenation operator:

LASTNAME || ' , ' || FIRSTNAME