Other related articles:

Recently viewed articles:


SQL CONCAT function returns a single string as a result of joining two strings passed as parameter values. A return value will occur only if the string expression in string1 is placed at the beginning of the result string, and the string expression in string2 is placed at the end; an error will be returned if both values for the arguments have not been provided. There are two ways of concatenating text data or text-based columns in Oracle. The first is to use the concatenation operator, which are two vertical pipe (||) characters. The second is to use the SQL CONCAT () function, in which we pass parameter values to SQL CONCAT function.

Example 1:

This example uses SQL CONCAT (||) operator to concatenate firstname and lastname columns of employee table including a single space concatenated between both columns. This statement is using || operator twice to complete this action:

SELECT firstname || ‘ ‘ || lastname AS FullName FROM employee;


Example 2:

This query will also return firstname and lastname concatenated from employee column but without any space between them. It uses SQL CONCAT function to complete this action:

SELECT CONCAT(firstname, lastname) AS FullName FROM employee;