It's taken quite a while until the bug reappeared. I've traced DBI and ODBC and it really seems to me that the Hana ODBC driver yields wrong results: SQLDescribeColW.c returns the type 0 for all columns, even though some of them are INT and some NVARCHAR:
DBI trace:
| bind_columns fbh=14bcf68 fields=10 | |
| Bind 1: type = CHAR(1), buf=14be528, buflen=11 | |
| Bind 2: type = CHAR(1), buf=14be534, buflen=101 | |
| Bind 3: type = CHAR(1), buf=14be59c, buflen=256 | |
| Bind 4: type = CHAR(1), buf=14be69c, buflen=256 | |
| Bind 5: type = CHAR(1), buf=14be79c, buflen=256 | |
| Bind 6: type = CHAR(1), buf=14be89c, buflen=11 | |
| Bind 7: type = CHAR(1), buf=14be8a8, buflen=20 | |
| Bind 8: type = CHAR(1), buf=14be8bc, buflen=20 | |
| Bind 9: type = CHAR(1), buf=14be8d0, buflen=256 | |
| Bind 10: type = CHAR(1), buf=14be9d0, buflen=256 |
i.e. all columns are treated as CHAR,
DBD::ODBC trace:
[ODBC][58159][SQLDescribeColW.c][155]
Entry:
Statement = 0x14b9340
Column Number = 9
Column Name = 0x14bd95a
Buffer Length = 256
Name Length = 0x14bd238
Data Type = 0x14bd242
Column Size = 0x14bd23c
Decimal Digits = 0x14bd240
Nullable = 0x14bd244
[ODBC][58159][SQLDescribeColW.c][398]
Exit:[SQL_SUCCESS]
Column Name = [C]
Data Type = 0x14bd242 -> 0
Column Size = 0x14bd23c -> 255
Decimal Digits = 0x14bd240 -> 0
Nullable = 0x14bd244 -> 1
i.e. after calling SQLDescribeColW (which means it is a unicode-enabled version), the column type is 0, i.e. CHAR (the trace is identical for all columns).
So there seems to be an incompatibility between the Hana ODBC driver and the Perl module DBD::ODBC and as the Perl module has a lot more users than Hana, I'd first assume that the incompatibility lies on Hana side, doesn't it? I haven't found a way to force DBD::ODBC to override the column type, so I'm stuck.
-- Micha