Concatenation Operator

The concatenation operator, ||, concatenates its right operand onto the end of its left operand; it operates on character string or bit string expressions.

Since all built-in data types are implicitly converted to strings, this function can act on all built-in data types.

Syntax

{
   { CharacterExpression || CharacterExpression } |
   { BitExpression || BitExpression }
}

CharacterExpression

An expression.

expression1

An expression.

expressionN

You can specify more than two argument; you MUST specify at least two arguments.

Results

For character strings:

  • If both the left and right operands are of type  VARCHAR.
  • The normal blank padding/trimming rules for CHAR and VARCHAR apply to the result of this operator.
  • The length of the resulting string is the sum of the lengths of both operands.

Examples

   -- returns 'San Francisco Giants'
splice> VALUES 'San' || ' ' || 'Francisco' || ' ' || 'Giants';

   -- returns NULL
splice> VALUES CAST (null AS VARCHAR(7))|| 'Something';

   -- returns 'Today it is: 93'
splice> VALUES 'Today it is: ' || '93';

See Also