Home >Database >Mysql Tutorial >How to Fix 'ORA-00909: invalid number of arguments' in Oracle's CONCAT Function?
Error: "ORA-00909: invalid number of arguments" in CONCAT Function
In your query, you are attempting to use the CONCAT function to concatenate three arguments:
SELECT CONCAT(Name, "(", SUBSTR(Occupation, 1, 1), ")") FROM Occupations;
However, CONCAT only accepts two arguments, and therefore throws the error "ORA-00909: invalid number of arguments."
Solution
To fix this error, you can either use the concatenation operation (||) or the CONCAT_WS function.
Using the concatenation operation (||):
SELECT Name || '(' || SUBSTR(Occupation, 1, 1) || ')' FROM Occupations;
Using the CONCAT_WS function:
SELECT CONCAT_WS('(', Name, SUBSTR(Occupation, 1, 1), ')') FROM Occupations;
Both methods will concatenate the Name, the opening parenthesis, the first character of the Occupation, and the closing parenthesis.
Additional Notes:
The above is the detailed content of How to Fix 'ORA-00909: invalid number of arguments' in Oracle's CONCAT Function?. For more information, please follow other related articles on the PHP Chinese website!