Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL Oracle
hello,
 
I have 2 tables A and B.
Both of them have a field varchar2(55), named for example "address".
A.address contains cyrillic characters inserted from a mapper application.
During the flow, I need to select data from A.address and insert in B.address.
 
For an unknown reason, my statement return an error which said that the maximul lenght exceeded in B.address during the insertion.
 
Does anyone know why it is happening?
 
thanks a lot,
mikcutu.
Posted 4-Oct-12 8:31am
mikcutu472
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The problem is that you are not using data types supporting Unicode.
 
My guess is that you might have created the situation where you feed Unicode to Oracle, bytewise, and Oracle tries to interpret the bytes as separate characters. As Cyrillic code points get more then one bytes each with any of the UTFs, the total number of these misinterpreted "characters" exceeds 55. Are you getting the idea.
 
You can fix this by using data types supporting Unicode; varchar can be replaced with Unicode NVARCHAR2. Please see:
http://docs.oracle.com/cd/B19306_01/server.102/b14225/ch7progrunicode.htm[^].
 
It's also good to understand what Unicode is — there are too many myths around adopted by too many developers. In particular, this is not a 16-bit encoding. This is not the encoding at all, UTFs are. Please see:
http://en.wikipedia.org/wiki/Unicode[^],
http://unicode.org/[^],
http://en.wikipedia.org/wiki/Code_point[^],
http://en.wikipedia.org/wiki/Byte_order_mark[^],
http://en.wikipedia.org/wiki/UTF[^],
http://unicode.org/faq/utf_bom.html[^].
 
Good luck,
—SA
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

While agreeing with SA, I might add that Oracle of course works with cyrillic characters, if set up properly.
Check the NLS_LANG settings on the server AND the client that they support the language you use.
Note that the Server and the clients need to have the same setting and that you can't really change the setting on the server after installation while the NLS_LANG settings affects the tables on file level.
The best NLS_LANG setting is of course to use one of the UNICODE settings and not some national codepage, that would effectively turn varchar2 into nvarchar2.
 
More on NLS_LANG here[^].
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.140926.1 | Last Updated 5 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100