CONCAT with function in Oracle

CONCAT WITH ||
The || is an operator which is used to simplify the work of the CONCAT function and thus is used to concatenate two or more strings together. The || operator is supported in the various versions of the Oracle/PLSQL, including, Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i and Oracle 8i.

Syntax:

string_1 || string_2 || string_n

Parameters:
String_1: It is used to specify the first string to concatenate.
String_2: It is used to specify the second string to concatenate.
String_n: It is used to specify the nth string to concatenate.

Example 1: Concatenation of two strings.

 ‘HELLO’ || ‘ WORLD’

Output:

 ‘HELLO WORLD’

Explanation:
The two strings are concatenated as one string.
Example 2: Concatenation of strings with space.

SELECT ‘HELLO’ || ‘ ’ || ‘WORLD’ 
FROM dual;

Output:

 ‘HELLO WORLD’

Explanation:
All the three strings are concatenated as one string.

Example 3: Concatenation of strings with single quotes.

SELECT ‘LET’‘S’ || ‘ BE’ || ' FRIENDS'
FROM dual;

Output:

 ‘LET’S BE FRIENDS’

Explanation:
All the three strings are concatenated as one string.

Example 4: Concatenation of strings with single quotes (second method).

SELECT ‘LET’ || “ ” || ‘S’ || ‘ BE’ || ' FRIENDS'
FROM dual;

Output:

 ‘LET’S BE FRIENDS’

Explanation:
All the four strings are concatenated as one string.

Please Share