CONCAT function in Oracle

CONCAT function in Oracle

CONCAT is one of the vital string/char functions of Oracle. It is used to concatenate two strings together. The CONCAT function is supported in the various versions of the Oracle/PLSQL, including, Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, and Oracle 8i.

Syntax 1: To concatenate two strings:
CONCAT( string1, string2 )
Syntax 2: To concatenate more than two strings:
SELECT CONCAT (CONCAT ( string1, string2 ), string3)
FROM dual;
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 3: It is used to specify the third string to concatenate.

Example 1: Concatenation of two strings.
CONCAT (‘HELLO’, ‘ WORLD’)
Output:
‘HELLO WORLD’
Explanation:
The two strings are concatenated as one string.
Example 2: Concatenation of more than two strings.
SELECT CONCAT( CONCAT (‘HELLO’, ‘ MY’), ' FRIENDS')
FROM dual;
Output:
‘HELLO MY FRIENDS’

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

Example 3: Concatenation of strings with single quotes.
SELECT CONCAT( CONCAT (‘LET’‘S’, ‘ BE’), ' FRIENDS')
FROM dual;
Output:
‘LET’S BE FRIENDS’

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