Oracle中如何转换列的字符集
我有一个表,我们的服务提供商在其中插入了 UNICODE 数据,但我的 Oracle 字符集是 WE8ISO8859P1。
现在为了获取数据,我使用了 Oracle 的以下功能,但它显示?????????
select CONVERT(message,'AL32UTF8','WE8ISO8859P1') from client_campaigns
还有一件事消息可以是 CLOB 类型。
由于数据丢失,我无法更改数据库的字符集,其次它在生产中,字符集的更改可能会导致错误。
现在请指导我如何以 UNICODE 形式获取此数据?
问候, 伊姆兰
I have a table in which our service provider insert UNICODE data but my oracle characterset is WE8ISO8859P1.
Now to get that data i used following function of oracle but it is displaying ???????
select CONVERT(message,'AL32UTF8','WE8ISO8859P1') from client_campaigns
one thing more message coulmn is of CLOB type.
I cant change characterset of my Database due to dataloss and second its in production and changes in characterset may lead to errors.
Now please guide how i can get this data as UNICODE?
Regards,
imran
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
插入字符(VARCHAR2 或 CHAR 或 CLOB)列中的字符串将始终转换为数据库字符集。这意味着在您的情况下插入的数据将转换为 WE8ISO8859P1。由于 UNICODE 不是 WE8ISO8859P1 的子集,因此您将丢失信息。某些在您的字符集中不可用的字符在插入时会转换为
?
。你应该做什么?对于新数据,有几个选项:
如果可以选择的话,我会选择(1)或(3)。使用 RAW 会禁用许多功能并增加复杂性。
显然,仅使用数据库可用的数据无法恢复先前的数据:您必须在新结构中重新导入旧数据。
Strings inserted in a character (VARCHAR2 or CHAR or CLOB) column will always be converted to the database character set. This means that the inserted data is converted to WE8ISO8859P1 in your case. Since UNICODE is not a subset of WE8ISO8859P1, you will lose information. Some characters unavailable in your character set are transformed into
?
upon insert.What should you do? There are a couple of options for new data:
I would go with option (1) or (3) if given the choice. Working with RAW disables a lot of features and adds complexity.
Obviously prior data will be impossible to restore with only the data available to the database: you will have to reimport old data in the new structure.