oracle “?” oracle中的(倒问号)字符

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35149891/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 03:09:05  来源:igfitidea点击:

"?" (inverted question mark) character in oracle

sqloraclenls-lang

提问by Mohit Tamrakar

I found "?" character (inverted question mark) in the database tables in place of single quote (') character.

?在数据库表中找到“ ”字符(倒问号)代替单引号 ( ') 字符。

Can any one let me know how i can avoid this character from the table.

任何人都可以让我知道如何从表格中避免这个字符。

There are many rows which contains the text with this character but not all single quotes are turning to this ? symbol.

有很多行包含带有此字符的文本,但并非所有单引号都转到此 ? 象征。

I am not even able to filter the rows to update this character (?) with single quote again.

我什至无法过滤行以再次使用单引号更新此字符(?)。

When i user Like "%?%" it filters me the text containing ordinary question mark (?)

当我用户 Like "%?%" 时,它会过滤我包含普通问号 (?)

回答by Wernfried Domscheit

In general there are two possibilities:

一般有两种可能:

  1. Your database tables reallyhave ?characters caused by wrong NLS_LANGsettings when data was inserted (or the database character set does not support the special character). In such case the LIKE '%?%'condition should work. However, this also means you have corrupt data in your database and it is almost impossible to correct them because?stands for anywrong character.
  2. Your client (e.g. SQL*Plus) is not able to displaythe special character caused by wrong NLS_LANGsettings or the font does not support the special character.
  1. 您的数据库表中确实存在?由于NLS_LANG插入数据时设置错误导致的字符(或数据库字符集不支持特殊字符)。在这种情况下,LIKE '%?%'条件应该有效。但是,这也意味着您的数据库中有损坏的数据并且几乎不可能更正它们,因为?代表任何错误的字符。
  2. 您的客户端(例如在SQL * Plus)是不能够显示造成错误的特殊字符NLS_LANG设置或字体不支持特殊字符。

Which client do you use (SQL*Plus, TOAD, SQL Developer, etc.)?

您使用哪个客户端(SQL*Plus、TOAD、SQL Developer 等)?

What is your NLS_LANGEnvironment variable, resp. your Registry key HKLM\SOFTWARE\ORACLE\KEY_%ORACLE_HOME_NAME%\NLS_LANGor HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_%ORACLE_HOME_NAME%\NLS_LANG?

你的NLS_LANG环境变量是什么?您的注册表项HKLM\SOFTWARE\ORACLE\KEY_%ORACLE_HOME_NAME%\NLS_LANGHKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_%ORACLE_HOME_NAME%\NLS_LANG

What do you get when you select DUMP(... , 1016)from your table?

当您DUMP(... , 1016)从表中选择时,您会得到什么?

回答by gpeche

Was it really a simple quote (ASCII 39)? If they actually were some sort of "smart quotes", those do have mappings in windows-1252 but there is no ISO-8859 mapping for them, so if your database charset is ISO-8859-1 and you try to insert some windows-1252 text, Oracle tries to translete from windows-1252 to ISO-8859-1 and uses chr(191) to signal an unmappable character. chr(191) happens to be the opening question mark.

它真的是一个简单的引用(ASCII 39)吗?如果它们实际上是某种“智能引号”,那么它们确实在 windows-1252 中有映射,但没有 ISO-8859 映射,所以如果您的数据库字符集是 ISO-8859-1 并且您尝试插入一些窗口 - 1252 文本,Oracle 尝试从 windows-1252 转换为 ISO-8859-1,并使用 chr(191) 表示不可映射的字符。chr(191) 恰好是开头的问号。

You can check that by executing this (copy the select to preserve the smart quotes):

您可以通过执行此检查(复制选择以保留智能引号):

select dump('‘'“”') from dual

This behaviour is basically "correct", as what you are asking Oracle to do cannot be done, though it is not very intuitive.

这种行为基本上是“正确的”,因为您要求 Oracle 做的事情无法完成,尽管它不是很直观。

See windows-1252, ISO8859-1and ISO-8859-15charsets for comparison. Note that windows uses the range 127-159 that is not used in the ISO charsets

请参阅windows-1252ISO8859-1ISO-8859-15字符集进行比较。请注意,windows 使用了 ISO 字符集中未使用的范围 127-159