"||" 和有什么不一样 Oracle 中的运算符和 concat 函数?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11403931/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the difference between "||" operator and concat function in Oracle?
提问by Java SE
Would it be possible to explain the difference between the concat()
function and the ||
operator in Oracle?
能否解释一下Oracle 中concat()
函数和||
运算符之间的区别?
Which one is better in terms of performance?
哪个在性能方面更好?
回答by Justin Cave
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.
||
是 ANSI 标准字符串连接运算符(但不幸的是,并非每个数据库都<cough>SQL Server</cough>
选择支持该标准)。许多数据库都支持一个CONCAT
函数,因此将代码移植CONCAT
到不同的数据库可能会更容易。
回答by rahul
'concat' function can be operated only on 2 variables or columns, while 'concat' operation can be done for any number of variables or columns.
'concat' 函数只能对 2 个变量或列进行操作,而 'concat' 操作可以对任意数量的变量或列进行。