Oracle Database Concatenation: Operator || or concat() function


Example

The Oracle SQL and PL/SQL || operator allows you to concatenate 2 or more strings together.

Example:

Assuming the following customers table:

 id  firstname    lastname
---  -----------  ----------
  1  Thomas       Woody

Query:

 SELECT firstname || ' ' || lastname || ' is in my database.' as "My Sentence" 
   FROM customers;

Output:

My Sentence
---------------------------------
Thomas Woody is in my database.

Oracle also supports the standard SQL CONCAT(str1, str2) function:

Example:

Query:

 SELECT CONCAT(firstname, ' is in my database.') from customers;

Output:

Expr1
---------------------------------
Thomas is in my database.