Chapter 4: SQL Language Elements
4.9.2.15 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 (see page 4-32). However, the concatenation operator allows easy concatenation of more than two character expressions, while the CONCAT function requires nesting.
Example
SELECT name, empno, salary
FROM customer
WHERE project = CONCAT('US',proj_nam);
Notes
- Both the arguments must be of type CHARACTER or VARCHAR.
- The result is of type VARCHAR.
- If any of the argument expressions evaluates to null, the result is null.
- The trailing blanks for the first argument are removed.