Would it be possible to explain the difference between the concat()
function and the ||
operator in Oracle?
Which one is better in terms of performance?
There is no functional difference.
||
is the ANSI standard string concatenation operator (though, unfortunately, not every database <cough>SQL Server</cough>
chooses to support the standard). Many databases support a CONCAT
function so it may be easier to port code using CONCAT
to different databases.
'concat' function can be operated only on 2 variables or columns, while 'concat' operation can be done for any number of variables or columns.