Bug #923 concat as In Oracle or SQLServer
Submitted: 25 Jul 2003 1:18 Modified: 27 Aug 2003 13:20
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: User-defined functions ( UDF ) Severity:S4 (Feature request)
Version:1.4.0-alpha OS:Windows (Windows)
Assigned to: CPU Architecture:Any

[25 Jul 2003 1:18] [ name withheld ]
Description:
The "concat" function is very different from Oracle, SQL Server, DB2 or standard SQL/92, so is very difficult to port queries.

Oracle uses " 'string1' || 'string2' " and SQL Server " 'string1' + 'string2' ".
The standard SQL/92 is '||' 
In MySQL the syntax is " concat('string1','string2') ".

How to repeat:
create table items (id char(10), descr char(30))

select id || ':' || descr from items
[27 Aug 2003 13:20] Peter Zaitsev
MySQL has possibility to use || for concat operation, 
try running MySQL server with --ansi option

It will make its behavior more ansi-like in some other cases.
[29 Aug 2003 1:10] [ name withheld ]
Ok, I can set sql-mode to have "||" as in Oracle.

But if I do a query SELECT Code+"a" FROM MyTable (SQLServer syntax to add two strings) I get a 0 as the sum of the two strings.

I think that having "+" between strings to concatenate two string is what every user expect.