2
votes

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

4
Have you tried changing your backing datatype to msdn.microsoft.com/en-us/library/ms186939.aspx - Alex
i don't have an option to change datatype. - TopCoder

4 Answers

1
votes

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

0
votes

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
-1
votes

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

-2
votes

try to using something around this statement

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