将Charset设置为SQL*Plus中的UTF-8

发布于 2025-01-28 13:52:15 字数 320 浏览 1 评论 0原文

我有一个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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

美男兮 2025-02-04 13:52:15

sql*plus从cmd窗口继承了字符集。您需要将编码设置为UTF-8并说明Oracle。这是由nls_lang参数完成的。

尝试以下操作:

chcp 65001
set NLS_LANG=.AL32UTF8
sqlplus ....

当然,只有当您的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 by NLS_LANG parameter.

Try this:

chcp 65001
set NLS_LANG=.AL32UTF8
sqlplus ....

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 "?"

著墨染雨君画夕 2025-02-04 13:52:15

您通常会使用环境变量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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文