插入的西里尔字符超过了允许的最大长度 [英] inserting cyrillic characters exceeds the maximum lenght allowed

查看:73
本文介绍了插入的西里尔字符超过了允许的最大长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有2个表A和B.
他们两个都有一个字段varchar2(55),例如以"address"命名.
地址包含从映射器应用程序插入的西里尔字符.
在流程中,我需要从A.address中选择数据并插入B.address中.

由于未知的原因,我的语句返回一个错误,该错误表明插入期间B.address中超出了最大长度.

有谁知道为什么会这样吗?

非常感谢,
mikcutu.

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.

推荐答案

问题是您没有使用支持Unicode的数据类型.

我的猜测是,您可能已经创建了将Unicode逐字节提供给Oracle的情况,而Oracle试图将字节解释为单独的字符.随着任何一个UTF的西里尔字母代码点每个都超过一个字节,这些被误解的字符"的总数超过了55个.您明白了吗?

您可以使用支持Unicode的数据类型来解决此问题;可以将varchar替换为Unicode NVARCHAR2.请参阅:
http://docs.oracle.com/cd/B19306_01/server.102/b14225/ch7progrunicode.htm [^ ].

了解Unicode是什么也很好-太多的开发人员采用了太多的神话.特别是,这不是16位编码.这根本不是编码,UTF是.请参阅:
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 [
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


虽然我同意SA,但我可以补充一点,如果设置正确,Oracle当然可以使用西里尔字母.
检查服务器和客户端上的NLS_LANG设置是否支持您使用的语言.
请注意,服务器和客户端需要具有相同的设置,并且安装后您不能真正更改服务器上的设置,而NLS_LANG设置会影响文件级别的表.
最佳的NLS_LANG设置当然是使用UNICODE设置之一而不是某些国家代码页,这样可以有效地将varchar2转换为nvarchar2.

NLS_LANG
此处的更多信息 [
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[^].


这篇关于插入的西里尔字符超过了允许的最大长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆