Hello. I need to insert some data from XML into Oracle. I extract tables from XML using xmlmap. Both XML and XMLMAP have 'UTF-8' encoding. When I select some string columns from created tables I get normal cyrillic symbols, such as 'тестовая строка'. But when I insert them into Oracle tables, these letters turn into '���������� ������'. When I try to select these Oracle tables in proc sql statement, I get '???????? ??????'. Do you have any suggestions, what's the problem.
proc sql;
select * from XMLLIB.Table_Name; /*Checking string data, getting 'тестовая строка'*/
insert into ORALIB.Table_Name
select * from XMLLIB.Talbe_Name; /*Insert data into Oracle Talbe, returns '�������� ������'*/
select * from ORACLE.Table_Name; /*returns '???????? ??????'*/
quit;
Once again: both &CUR_XML and &CUR_MAP have 'UTF-8' encoding. Thanks in advance.
I've found the solution. The environment variable NLS_LANG was empty. I've changed it to RUSSIAN_CIS.CL8ISO8859P5 and it worked.
I suspect that the UTF-8 chain must not be broken for this to work.
- SAS may have to run in UTF8 mode, though since you don't use SAS storage you may be able to get away with this. Maybe.
- The Oracle database should be set to use the UTF-8 character set
- The intermediate layers (ODBC driver or SQL*Net?, SAS/Access) must also support UTF-8.
Your characters may get jumbled at any of these stages.
I've found the solution. The environment variable NLS_LANG was empty. I've changed it to RUSSIAN_CIS.CL8ISO8859P5 and it worked.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.