将Charset设置为SQL*Plus中的UTF-8
我有一个SQL脚本,其中包含以下语句:
插入员工(fname,lname)values('jörg','müller');
我的数据库charset IST设置为AL32UTF8,但是当我执行脚本时在sql 中,加上德语字母Ö和ü不能正确保存。如何将SQL Plus的Charset设置为UTF-8?
是否可以在我的脚本文件中将SQL*Plus Charset设置为UTF-8(SQL脚本文件包含将CharSet设置为UTF-8的命令)?
我的运行时环境是窗口,但脚本也应该能够在UNIX上运行。我的甲骨文版本是19c。
I have a SQL script that contains the following statement:
insert into employee(fname,lname) values('Jörg','Müller');
My Database Charset ist set to AL32UTF8 but when I execute the script in SQLPlus the german letters Ö and Ü are not saved correctly. How can I set the Charset of SQLPlus to UTF-8?
Is it possible to set the SQL*Plus Charset to UTF-8 in my script file (the sql script file contains the command to set the charset to UTF-8)?
My runtime environment is Window but script should also be able to run on unix. My oracle version is 19c.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
sql*plus从
cmd
窗口继承了字符集。您需要将编码设置为UTF-8并说明Oracle。这是由nls_lang
参数完成的。尝试以下操作:
当然,只有当您的SQL文件也被保存为UTF-8时,这才能起作用。否则,您需要从上方调整字符集。
参见 odbcconnection
SQL*Plus inherits the character set from
cmd
window. You need to set encoding to UTF-8 and tell it Oracle. This is done byNLS_LANG
parameter.Try this:
Of course, this works only if your sql-file is also saved as UTF-8. Otherwise you need to adapt character sets from above.
See OdbcConnection returning Chinese Characters as "?"
您通常会使用环境变量NLS_LANG,例如在Windows中设置这样的设置:set nls_lang = American_america.al32utf8
You would typically use the environment variable NLS_LANG and for example set it like this in windows: SET NLS_LANG=AMERICAN_AMERICA.AL32UTF8