Home > Back-end >  How to convert UTF-16 symbol code to nvarchar2 in Oracle?
How to convert UTF-16 symbol code to nvarchar2 in Oracle?

Time:09-23

I have a UTF-16 code, which is \D83D, and I want to get a symbol out of this code. I need some function like chr that returns nvarchar2 string. Like this:

select convert_utf16_to_nchar('\D83D') from dual;

CodePudding user response:

I think you are looking for unistr

UNISTR takes as its argument a text literal or an expression that resolves to character data and returns it in the national character set. The national character set of the database can be either AL16UTF16 or UTF8. UNISTR provides support for Unicode string literals by letting you specify the Unicode encoding value of characters in the string. This is useful, for example, for inserting data into NCHAR columns.

Example

SELECT UNISTR('abc\00e5\00f1\00f6') FROM DUAL;

UNISTR
------
abcåñö
  • Related