This content has been marked as final. Show 4 replies
You need to explain what you mean by converting Unicode characters into a Unicode string. In the terminology that I know, a string is a sequence of characters so you convert characters into a string by concatenating them ;-)
I'm getting a bit tied up in Oracle terminology. I want to be able to convert a character, or string of characters, into the unicode code or codes. The exact reverse of UNISTR.
The reverse of UNISTR is ASCIISTR.
Fantastic, dunno why I couldn't find that earlier. A note in the doco would have been helpful!
SELECT x, utl_raw.cast_to_raw(x), y, utl_raw.cast_to_raw(y), asciistr(x), asciistr(y)
FROM (SELECT UNISTR('\4E2D') as x, '中' AS y FROM DUAL);
"X" "UTL_RAW.CAST_TO_RAW(X)" "Y" "UTL_RAW.CAST_TO_RAW(Y)" "ASCIISTR(X)" "ASCIISTR(Y)"
"中" "4E2D" "中" "E4B8AD" "\4E2D" "\4E2D"