Press "Enter" to skip to content

Oracle SQL Query to Combine Two Strings

In this Oracle SQL query example, you will learn how to combine two strings.

To combine two strings in Oracle, you can use concat() function or double pipes ||operator. Below are the examples:

Using Concat Function to Combine Two Strings

The concat() function takes two arguments string1 and string2 and returns the string concatenated string1 with string2.

Syntax

concat(string1, string2)

Example

Select concat('abc', 'xyz') from dual;

Output

abcxyz

Using || Operator to Combine Two Strings

Using the || operator, you can not only combine two strings but more than two strings. Here is an example:

SELECT
    'abc'
    || 'xyz'
    || 'aaa'
    || 'bbb'
FROM
    DUAL

Output

abcxyzaaabbb

Have you found the answer to your question? If not, you can discuss it with me in the comments section below or join my Q&A community OrclQA.com for developers and ask your question. It is FREE.

Vinish Kapoor

Follow

Hi, I am a full stack developer and writing about development. I document everything I learn and help thousands of people. foxinfotech.in is created, written, and maintained by me; it is built on WordPress, and hosted by Bluehost. Connect with me on Facebook, Twitter, GitHub, and get notifications for new posts.

guest
0 Comments
Inline Feedbacks
View all comments