CONCAT FunctionThe CONCAT function joins two expressions together into a single string.
The function concatenates two strings.
If more than two strings must be concatenated, you must either:
nest CONCAT functions, or
use the concatenation operator ||.
Example with nesting:
The arguments may be any of the following types:
CHAR
VARCHAR2
NCHAR
NVARCHAR2
CLOB
NCLOB
Arguments of other data types are implicitly converted to VARCHAR2 before concatenation.
The return type depends on the argument data types.
| Condition | Return Type |
|---|---|
If any argument is NCLOB |
NCLOB |
If there is a CLOB together with NCHAR or NVARCHAR2 |
NCLOB |
If there is a CLOB |
CLOB |
If there is NVARCHAR2 or VARCHAR2 with NCHAR |
NVARCHAR2 |
If there is VARCHAR2 |
VARCHAR2 |
If there is NCHAR |
NCHAR |
| Otherwise | CHAR |
CONCAT ignores NULL values.
If one argument is NULL, the result is the other argument.
Example:
Unlike the || operator, the CONCAT function can combine only two strings.
To concatenate multiple values you must nest the function: