How to insert indian rupee symbol in oracle 11g?

I want to insert indian rupee symbol in oracle 11g.

I tried:

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

but does not work.

SELECT ascii('₹') FROM dual; it gives the ascii value for the Rupee symbol, but after insertion it shows the field in a row.

here you can see

 SELECT chr(14844601) FROM dual; 
+3
source share
1 answer

It seems you just need to change the font in SQL Developer. Check out this SQLFiddle .

There are two things in the question text: get the Unicode character from it. nchr() should use a function instead of chr() . Secondly, the constant string '₹' , processed as varchar2 , and for the nvarchar2 constant to be specified correctly, you must add N to this literal: N'₹' .

To change the font, simply open the menu Tools -> Preferences ...

enter image description here

and select Code Editor -> Fonts node. On this page, you can select a font from the Font Name drop-down list. Copy and run the rupee symbol in the Sample Text field to see if the fonts are acceptable. Arial (on win7) works fine for me:

enter image description here

This parameter changes the font of the grid, as well as the font in the code editor:

enter image description here

In the above steps, you will only get half way to get full support for the rupee symbol, because select N'₹' from dual will only return a question mark. This is due to the conversion of the text encoding of the request between the client and server sides.
To solve this problem, Oracle provides an ORA_NCHAR_LITERAL_REPLACE environment setting . This parameter allows the client API to analyze the request text for character constants with the prefix N and use a special internal format for encoding such data on the client side before sending the request text to the server. Unfortunately, SQL Developer uses the Thin JDBC API, which ignores this environment setting, so adding this environment variable does not solve the problem.

But there is another way to enable the same behavior with the oracle.jdbc.convertNcharLiterals property, which acts at the system and connection level.
To enable this property, find the ide.conf file in the sqldeveloper\ide\bin in the SQL Developer installation folder and add this line to the end of the file:

 AddVMOption -Doracle.jdbc.convertNcharLiterals=true 

Save the file and restart SQL Developer, everything should work now:

enter image description here

PS In instructions based on SQL Developer version 3.2, older versions may have a different configuration file location. For instance. sqldeveloper\bin\sqldeveloper.conf .

+2
source

Source: https://habr.com/ru/post/958384/


All Articles