Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

CONCAT function (ODBC compatible)

Syntax

CONCAT ( char_expression , char_expression )

Description

The scalar function CONCAT returns a concatenated character string formed by concatenating argument one with argument two.

The CONCAT scalar function is similar to the concatenation operator. However, the concatenation operator allows easy concatenation of more than two character expressions by nesting the CONCAT function.

Example

SELECT name, empno, salary

FROM customer

WHERE project = CONCAT('US',proj_nam);

Notes

  • Both the arguments must be of character type.
  • If one of the arguments is a literal and the other one a field reference, concatenation is possible only if the literal is convertible to the character set of the field reference. Otherwise an error is returned.
  • The result belongs to the character set of the arguments.
  • If any of the argument expressions evaluates to null, the result is null.
  • The trailing blanks for the first arguments are removed.

TOCIndex