Page 1 of 1

Char length issue

Posted: Wed 21 May 2014 10:39
by ez
Hello,

I have upgraded the 4.70 driver to the last 6.3.6 and I encounter the following problem :
a select from a column declared as CHAR(4 CHAR) with nls_length_semantics = 'CHAR' returns the value 'DATA ' (16 characters) whereas the the driver 4.70 correctly returns the value 'DATA' (4 characters as expected).

Both environnements are exactly the same, only the dll is replaced.
The character set of the database is AL32UTF8.

Should I make changes to the connection options for the new driver ?

Thanks.

Re: Char length issue

Posted: Fri 23 May 2014 09:17
by AlexP
Hello,

If you are using Delphi 2006 or higher, you should set the UseUnicode option to True. Otherwise, set the CharLength option to 1. However, if in the field multi-byte symbols are used, they will be displayed correctly.

Re: Char length issue

Posted: Thu 05 Jun 2014 12:25
by ez
Thanks, setting CharLength to 1 solved the problem.
Can you give me more explanations about this parameter because its purpose remains unclear to me: should it reflect the character's length used by the Oracle database or does it tell Oracle of the character's length expected by the driver when returning data ?

Re: Char length issue

Posted: Thu 05 Jun 2014 13:07
by AlexP
When working with strings, we allocate a buffer to store them. If the property CharLength = 0 , we calculate the required buffer depending on the parameters returned by the server: if CharLength <> 0 - we allocate the specified number of bytes for a symbol forcedly.