在Sql中插入UNICODE字符

发布于 2024-09-29 02:32:22 字数 217 浏览 1 评论 0原文

我正在尝试将 unicode 字符串放入 SQL*Plus: Release 10.2.0.2.0 数据库中,但遇到困难。如果我使用 SQLPlus 并将插入语句复制并粘贴到数据库中,则任何特殊字符都会插入为 ?或类似的东西。然后我尝试调用一个已编码为UTF-8的sql文件,结果是相同的。 有谁知道如何将unicode数据存入数据库?

谁能帮忙。如何在 sqlplus 中设置 NLS_LANG 选项

I am trying to get unicode strings into an SQL*Plus: Release 10.2.0.2.0 database but am having difficulties. If I use SQLPlus and copy and paste the insert statement into the database, any special characters are inserted as ? or something like that. I then try to call a sql file that has been encoded to UTF-8 and the outcome is the same.
Does anyone know how to get unicode data into database?

Can anyone help . How can i set NLS_LANG option within sqlplus

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(4

谁对谁错谁最难过 2024-10-06 02:32:22

SQL *Plus 不是数据库,它是 SQL 或 PL/SQL 数据库的基于命令行的前端。命令行通常仅支持 ANSI 或 ASCI 编码字符。因此,当您尝试粘贴命令时,程序(SQL *Plus)只是替换了文本,它无法弄清楚如何用“?”进行编码。标记。您可能需要切换到不同的客户端应用程序才能使用 UTF-8

SQL *Plus is not a database it's a command-line based front-end to a SQL or PL/SQL database. The command-line usually only supports ANSI or ASCI encoded characters. So when you try and paste in the command the program (SQL *Plus) just replaces the text it can't figure out how to encode with "?" marks. You probably need to switch to a different client application to use UTF-8

东京女 2024-10-06 02:32:22

就我而言,问题不在 sqlplus 中,而是在数据库运行的环境中。设置后

NLS_LANG=RUSSIAN_RUSSIA.UTF8

我可以插入 unicode 字符而不会出现任何失真。
可能需要重新启动一些才能生效(数据库或操作系统或两者)。我在 docker 中运行 Oracle XE 数据库,所以
我必须将 -e NLS_LANG=RUSSIAN_RUSSIA.UTF8 添加到 docker run... 命令,如下所示:

docker run -d --rm -p 49161:1521 --name db -e NLS_LANG=RUSSIAN_RUSSIA.UTF8 -e ORACLE_ALLOW_REMOTE=true wnameless/oracle-xe-11g

In my case the problem wasn't in sqlplus but in the environment in that the database was run. After I set

NLS_LANG=RUSSIAN_RUSSIA.UTF8

I could insert unicode characters without any distortion.
Some restarts may be needed for this to take effect (db or OS or both). I run an Oracle XE db in docker so
I had to add -e NLS_LANG=RUSSIAN_RUSSIA.UTF8 to the docker run... command as shown below:

docker run -d --rm -p 49161:1521 --name db -e NLS_LANG=RUSSIAN_RUSSIA.UTF8 -e ORACLE_ALLOW_REMOTE=true wnameless/oracle-xe-11g
小苏打饼 2024-10-06 02:32:22

设置 NLS_LANG 环境变量以使 SQL*Plus 理解您正在使用的字符表示形式。

http://www.sqlsnippets.com/en/topic-13434.html

Set the NLS_LANG environmental variable to make SQL*Plus understand the character representation you're using.

http://www.sqlsnippets.com/en/topic-13434.html

╭⌒浅淡时光〆 2024-10-06 02:32:22

尝试使用此语句周围的东西

update pp.pp_employee t  
set t.first_name=UNISTR('АБДАЛЛА')   
where t.emp_id =  5451  ;

try to using something around this statement

update pp.pp_employee t  
set t.first_name=UNISTR('АБДАЛЛА')   
where t.emp_id =  5451  ;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文