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?
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.
+
which is just like oracle's partial support of ANSI standard functions CHARACTER_LENGTH, OCTET_LENGTH , SUBSTRING or POSITION functions. –
Lheureux POSITION
and SUBSTRING
rather than documenting that they don't exist, for example, and if that was the question, I'd happily call out Oracle). In this particular case, it's annoying that SQL Server doesn't conform to the standard because virtually every other database does and SQL Server being the lone holdout means that you can't concatenate strings consistently across databases. –
Nasion ||
operator in MySQL performs a logical OR
on the two operands. 'foo' || 'bar'
yields '0'. Surprise! –
Punner 'concat' function can be operated only on 2 variables or columns, while 'concat' operation can be done for any number of variables or columns.
© 2022 - 2024 — McMap. All rights reserved.
||
as the concatenation operator. – Philpot