Oracle Sqlplus汉字乱七八糟
- 我在CentOS上使用Oracle Database 11G运行了一个简单的查询,但是我的字符集错误。
SQL> select col_name from table_name where rownum <= 1;
col_name
--------------------------------------------------------------------------------
¸ñ귎Ϊʯҩ¼¯΅mRNAт¹ےࠃ萮Ŀ802³µ¼乄լ¾»»¯ůͨ¹¤³̡£
- 我获得数据库字符集,如下所示,
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_AMERICA.ZHS16GBK
- 将字符集设置为客户端
echo'Export nls_lang =“ American_America.ZHS16GBK”'&gt;/etc/etc/profile&amp;&amp;&amp; source/etc/profile
- 重新运行查询SQL,但也有问题,我该如何解决。
- I run a simple query with oracle database 11g on CentOS, but I got wrong CHARACTER SET.
SQL> select col_name from table_name where rownum <= 1;
col_name
--------------------------------------------------------------------------------
¸ñ귎Ϊʯҩ¼¯΅mRNAт¹ےࠃ萮Ŀ802³µ¼乄լ¾»»¯ůͨ¹¤³̡£
- I get database CHARACTER SET as follows
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_AMERICA.ZHS16GBK
- Set CHARACTER SET to client
echo 'export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"'>>/etc/profile && source /etc/profile
- rerun query SQL, but also got problem, How can I resolve it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
Locale Charmap
或echo $ lang
检查您的终端设置,并验证它是否与ZHS16GBK
匹配。不需要使用与数据库相同的字符集。在您的终端中使用
nls_lang = American_america.al32utf8
和UTF-8也将起作用。重要的是,nls_lang
匹配您的终端字符集。另请参见
Check your terminal settings with
locale charmap
orecho $LANG
and verify if it matches withZHS16GBK
.It is not required to use the same character set as your database. Using
NLS_LANG=AMERICAN_AMERICA.AL32UTF8
and UTF-8 in your terminal will also work. It is important thatNLS_LANG
matches your terminal character set.See also OdbcConnection returning Chinese Characters as "?"