
Signature
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
IOD Conference
http://www.ibm.com/software/data/ondemandbusiness/conf2006/
>> Hi,
>>
[quoted text clipped - 35 lines]
>Cheers
>Serge
Well you are right, this is not EXACTLY the same SQL - I removed one
other parameter in the concat() i.e. it was:
concat('Unmatched on ', ?, ' some text')
Interestingly if I create a table:
create table fred (a char(100))
and run the following perl:
use DBI;
$dbh = DBI->connect("dbi:DB2:xxx", "db2inst1", "easysoft");
$sql = q/insert into fred (a) values(concat('hello ',?))/;
$sth = $dbh->prepare($sql);
$sth->execute("fred");
it works. But I run the following perl it fails (yet with another
error):
use DBI;
$dbh = DBI->connect("dbi:DB2:xxx", "db2inst1", "easysoft");
$sql = q/insert into fred (a) values(concat('hello ',?,' some
text'))/;
$sth = $dbh->prepare($sql);
$sth->execute("fred");
error is:
DBD::DB2::st execute failed: [IBM][CLI Driver][DB2/LINUX] SQL0418N A
statement
contains a use of a parameter marker that is not valid. SQLSTATE=42610
so may be it is something to do with the number of arguments to concat
i.e. 2 are ok and 3 are not.
Martin
--
Martin J. Evans
Wetherby, UK
Serge Rielau - 08 Jun 2006 22:55 GMT
>>> Hi,
>>>
[quoted text clipped - 76 lines]
> Martin J. Evans
> Wetherby, UK
CONCAT is a BINARY function.
If you want to concat more than two pieces either use infix notation:
'HELLO' || 'WORLD' || '!'
or
CONCAT('Hello', CONCAT('WORLD', !'))
Cheers
Serge

Signature
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
IOD Conference
http://www.ibm.com/software/data/ondemandbusiness/conf2006/
Martin Evans - 09 Jun 2006 08:09 GMT
>>>> Hi,
>>>>
[quoted text clipped - 84 lines]
>Cheers
>Serge
Serge,
Thanks - I should have realised that. I was porting some sql from
mysql to db2 and mysql supports concat(x,y,z,...) and didn't notice
concat was a 2 op function in db2. What put me on the wrong tack was
searching for the error code and seeing loads of other people getting
the same error with ucase(?).
Thanks again.
Martin
--
Martin J. Evans
Wetherby, UK