Oracle Unicode 假脱机
如何将表中的数据假脱机到包含 Unicode 字符的文件?
我有一个从 SQL*Plus 屏幕执行的 sql 文件,其内容是:
SET ECHO OFF
SET FEEDBACK OFF
SET HEADING OFF
SET PAGESIZE 0
SPOOL STREET_POINT_THR.BQSV
SELECT GEOX||'`'||GEOY||'`'||UNICODE_DESC||'`'||ASCII_DESC
FROM GEO.STREET_POINTS;
SPOOL OFF
How can I spool data from a table to a file which contains Unicode characters?
I have a sql file which I execute from SQL*Plus screen and its content is:
SET ECHO OFF
SET FEEDBACK OFF
SET HEADING OFF
SET PAGESIZE 0
SPOOL STREET_POINT_THR.BQSV
SELECT GEOX||'`'||GEOY||'`'||UNICODE_DESC||'`'||ASCII_DESC
FROM GEO.STREET_POINTS;
SPOOL OFF
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通过正确的设置,您的脚本可以与 SQL*Plus 一起使用。这是我测试它的方法:(
AMERICAN_ENGLISH.UTF8
。虽然 SQL*Plus 的 DOS 窗口不会显示所有 unicode 字符,但它们将被正确地假脱机到文件中。现在是脚本:
这将插入俄语字符ЙЖ
使用文本编辑器(在我的例子中是jEdit)使用正确的字符集(UTF-8)打开的文件会正确显示字符。
with the right settings your script does work with SQL*Plus. Here is what I did to test it:
AMERICAN_ENGLISH.UTF8
. While the DOS window of SQL*Plus won't display all unicode characters, they will be spooled correctly into the file.Now for the script:
This will insert the russian characters ЙЖ
The file, opened with a text editor (jEdit in my case) with the correct character set (UTF-8) displays the characters correctly.
我不认为 SQLPlus(至少在 Windows 上)支持 unicode。我刚刚在这里测试了一下,似乎不起作用。我不确定在这里提一下是否可以,但我自己的工具“Golden 6”确实支持 unicode 假脱机,尽管它仅适用于 Windows。请注意,您必须在 spool 命令之前使用“SET ENCODING [UNICODE | UTF-8 | ANSI] [NOBOM]”来选择正确的编码。
马克·福特
底栖软件
www.benthicsoftware.com
编辑:正如文森特指出的那样,它正在发挥作用。请注意,创建的UTF-8文件没有BOM,但它是一个UTF-8文件。
I don't think SQLPlus (at least on Windows) supports unicode. I just tested here and it doesn't seem to work. I'm not sure if it's ok to mention this here, but my own tool "Golden 6" does support unicode spooling although it is Windows only. Note that you have to use "SET ENCODING [UNICODE | UTF-8 | ANSI] [NOBOM]" before the spool command to choose the correct encoding.
Mark Ford
Benthic Software
www.benthicsoftware.com
Edit: As Vincent pointed out, it is working. Note that the UTF-8 file created has no BOM but is a UTF-8 file.