SELECT
HIRE_DATE, FIRST_NAME, LAST_NAME,
CONCAT(FIRST_NAME, ' ', LAST_NAME) AS "First and Last name"
FROM HR.EMPLOYEES
I'm trying to get one column by concatenating two other, but i get an error
ORA-00909: invalid number of arguments
CodePudding user response:
In oracle concat()
takes only two arguments. You can't use three instead. Here goes your solution.
SELECT
HIRE_DATE, FIRST_NAME, LAST_NAME,
CONCAT(CONCAT(FIRST_NAME, ' '), LAST_NAME) AS "First and Last name"
FROM HR.EMPLOYEES
Or you can use ||
to concat
more than two strings:
SELECT
HIRE_DATE, FIRST_NAME, LAST_NAME,
(FIRST_NAME || ' '|| LAST_NAME) AS "First and Last name"
FROM HR.EMPLOYEES
CodePudding user response:
You can use Pipe Symbol '|' to concatenation of strings in oracle ..It can have multiple inputs/ columns .
Syntax : Col1 || col2|| ' '|| Col3|| ' Any String'||Col4
Select hire_date, First_name, Last_name, First_name || ' ' || Last_Name as "First and Last name"
From HR.Employees
You can also use concat() function but it will takes only two input ... You need to use multiple times if you have more than 2 inputs.