如何在 Oracle 中将 UTF-16 符号代码转换为 nvarchar2?

How to convert UTF-16 symbol code to nvarchar2 in Oracle?

我有一个 UTF-16 编码,它是 \D83D,我想从这个编码中得到一个符号。我需要一些像 chr 这样 returns nvarchar2 字符串的函数。像这样:

select convert_utf16_to_nchar('\D83D') from dual;

我想你正在寻找 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.

示例

SELECT UNISTR('abc[=10=]e5[=10=]f1[=10=]f6') FROM DUAL;

UNISTR
------
abcåñö