×
☰ See All Chapters

Oracle CONCAT Function

Oracle CONCAT function adds two or more arguments together. In Oracle this function is equivalent to the concatenation operator (||).

Oracle CONCAT Function Syntax

CONCAT(arguement1, arguement2)

arguement1, arguement2: These arguments can be an expression or a direct value or a value from a column of any type. If all arguments are non-binary strings, the result is a non-binary string. If the arguments include any binary strings, the result is a binary string. If a numeric argument is given then it is converted to its equivalent non-binary string form. To concat more than two strings, you have to concat the concated string as below.

CONCAT(CONCAT(arguement1, arguement2), arguement3)

Oracle CONCAT Function Example

Creating table for demonstrating CONCAT Function

CREATE TABLE NAME

(

  FNAME  VARCHAR(10 )    NOT NULL,

  LNAME  VARCHAR(10 )

);

Insert into NAME (FNAME, LNAME) Values ('ADI', 'TEMP');

Insert into NAME (FNAME, LNAME) Values ('NAVEEN', 'SHETTY');

Insert into NAME (FNAME, LNAME) Values ('ARJUN', 'SHETTY');

Insert into NAME (FNAME, LNAME) Values ('HARISH', 'GOWDA');

Insert into NAME (FNAME, LNAME) Values ('HARI', 'PRASAD');

Insert into NAME (FNAME, LNAME) Values ('ARJUN', 'SHETTY');

Insert into NAME (FNAME, LNAME) Values ('KIRAN', 'KUMAR');

COMMIT;

Example 1

SELECT CONCAT(CONCAT(FNAME, ' '), LNAME) AS FULL_NAME

FROM NAME

oracle-concat-function-0

Example 2

SELECT CONCAT(FNAME, 'Hello') AS FULL_NAME

FROM NAME;

oracle-concat-function-1


All Chapters
Author