Page 1 of 1

Problem on charlength ora12899

Posted: Tue 15 Jan 2013 09:56
by djk_greensystems
Database converted to Unicode; Oracle 11.
Table-definitions changed from 10 byte to 10 char.

When adding fields in fieldsedit --> size is 40 (independent of orasession.options.charlength or orasession.options.unicode).

This is followed by a problem on updates, when filling in a string > 10 chars:

in 10 byte-situation: length of string is automically truncated to 10 characters max.
In new situation is this not the case anymore...

--> ora error message 12899: Value too large for column (actuel 20, maximum 10).

How to deal with this?

Re: Problem on charlength ora12899

Posted: Tue 15 Jan 2013 13:27
by AlexP
Hello,

To solve the problem, you should enable the UseUnicode option. In this case, the Delphi field length will be equal to the field length set when creating a table.
This is due to that Oracle returns field length as bytes, and the length will be 40 for the UTF8 encoding, since the maximum character length in this case is 4 bytes. When enabling the UseUnicode option, we know that the Unicode encoding will be used, and we calculate the string length correctly by ourselves. If this option is enabled, we remain the field length in bytes

Re: Problem on charlength ora12899

Posted: Sat 26 Jan 2013 21:20
by djk_greensystems
With setting above, I run into the following bug:

Local Oracle XE; Unicode works fine, both in direct mode and via TNS.

In Production: Oracle Standard
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
the following problem:
via TNS --> OK
Direct: Ora-error 12899. Also visible in Fields-editor in Delphi.
Example varchar2(100 char) = 400 Byte
Direct mode --> Size = 400
Via TNS --> Size = 100

Re: Problem on charlength ora12899

Posted: Mon 28 Jan 2013 10:01
by AlexP
Hello,

Finding of field length in both OCI and Direct modes depends on the UseUnicode option. If this option is set to False, the real field length in bytes (100 char= 400 bytes) will be taken into account, if the option value is True - field length in char. Please make sure this option is set to True when working in the Direct mode.