Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between "||" operator and concat function in Oracle?

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?

like image 558
Java SE Avatar asked Jul 09 '12 22:07

Java SE


People also ask

What is the use of || in Oracle?

The Oracle/PLSQL || operator allows you to concatenate 2 or more strings together.

What is the difference between the concat () and operator?

concat() method takes only one argument of string and concatenates it with other string. + operator takes any number of arguments and concatenates all the strings.

What is the difference between concat and concatenation?

CONCAT can join only two things while CONCATENATE can join two or more things.

What is the use of || operator in SQL?

The concatenation operator is a binary operator, whose syntax is shown in the general diagram for an SQL Expression. You can use the concatenation operator ( || ) to concatenate two expressions that evaluate to character data types or to numeric data types.


1 Answers

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.

like image 126
Justin Cave Avatar answered Oct 06 '22 00:10

Justin Cave