如何在oracle 11g中插入印度卢比符号? [英] How to insert Indian Rupee symbol in oracle 11g?

查看:70
本文介绍了如何在oracle 11g中插入印度卢比符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在oracle 11g中插入印度卢比符号.

I want to insert Indian Rupee symbol in oracle 11g.

我尝试过:

insert into currency(name, symbol) values ('rupee', unistr('\20B9'));

但无法正常工作.

SELECT ascii('₹') FROM dual;它提供卢比符号的ascii值,但插入后在行中显示框.

SELECT ascii('₹') FROM dual; it gives ascii value for Rupee symbol but after insert it shows box in the row.

在这里您可以看到

SELECT chr(14844601) FROM dual;

推荐答案

似乎您只需要在SQL Developer中更改字体.检查此SQLFiddle .

Seems that you just need to change a font in SQL Developer. Check this SQLFiddle.

问题文本有两件事是错误的:从代码中获取unicode符号 nchr() 函数代替 chr() .其次是将'₹'常量字符串视为varchar2,并正确指定nvarchar2常量,您

There are two things wrong in your question text: to get unicode symbol from it's code nchr() function must be used instead of chr(). Second is that '₹' constant string treated as varchar2 and to properly specify nvarchar2 constant you must prepend N to this literal: N'₹' .

要更改字体,只需打开Tools -> Preferences ...菜单

To change font just open Tools -> Preferences ... menu

,然后选择Code Editor -> Fonts节点.在此页面上,您可以从Font Name下拉列表中选择字体.将卢比符号复制并粘贴到Sample Text字段中,以快速查看字体是否可接受. Arial(在win7上)对我来说效果很好:

and choose Code Editor -> Fonts node. At this page you can select font from Font Name dropdown list. Copy and past rupee symbol into Sample Text field to quickly see if font are acceptable. Arial (on win7) works fine for me:

此设置会更改网格字体以及代码编辑器中的字体:

This setting changes grid font as well as font in code editor:

以上操作仅使您获得完全卢比符号支持的方式只有一半,因为select N'₹' from dual将仅返回问题符号.这是因为在客户端和服务器端之间完成了查询文本编码转换.
为解决此问题,Oracle
提供了ORA_NCHAR_LITERAL_REPLACE环境设置.此设置指导客户端API分析查询文本中以N为前缀的字符常量,并在将查询文本传输到服务器之前使用特殊的内部格式在客户端对此类数据进行编码.不幸的是,SQL Developer使用Thin JDBC API忽略了该环境设置,因此添加此环境变量不能解决问题.

Actions above puts you only to a half of the way to get full rupee symbol support because select N'₹' from dual will return only question sign. This is because of query text encoding conversion done between client and server side.
To deal with this issue Oracle provides ORA_NCHAR_LITERAL_REPLACE environment setting. This setting guides client API to analyze query text for character constants prefixed with N and use special internal format to encode such a data on client side before transferring query text to server. Unfortunately SQL Developer uses Thin JDBC API which ignores this environment setting, so adding this environment variable doesn't solve a problem.

但是有另一种方式使用oracle.jdbc.convertNcharLiterals属性打开相同的行为,该属性作用于系统和连接级别.
要打开此属性,请在SQL Developer安装文件夹的sqldeveloper\ide\bin目录中找到ide.conf文件,并将此行添加到文件末尾:

But there are another way to turn on same behavior with oracle.jdbc.convertNcharLiterals property which acts on a system and connection levels.
To turn this property on, locate ide.conf file in sqldeveloper\ide\bin directory in SQL Developer installation folder and add this line to the end of a file:

AddVMOption -Doracle.jdbc.convertNcharLiterals=true

保存文件并重新启动SQL Developer,所有事情现在都可以正常工作:

Save file and restart SQL Developer, all things must work now:

P.S.基于SQL Developer版本3.2的说明(旧版本)可能具有配置文件的其他位置.例如. sqldeveloper\bin\sqldeveloper.conf.

P.S. Instructions based on SQL Developer Version 3.2, old versions may have another location of configuration file. E.g. sqldeveloper\bin\sqldeveloper.conf .

这篇关于如何在oracle 11g中插入印度卢比符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆