Hi,
Is there an Oracle supplied function for finding a character's codepoint value (either in decimal or hex)? I.e. given a character like 'Æ' (U+00C6) I'd like a function that returns either 198 or 'C6'.
The ASCII() function is the closest thing I could find but it returns varied, and rather unhelpful decimal representations of the character, not its codepoint. E.g.
-- on a db with NLS_CHARACTERSET and NLS_NCHAR_CHARACTERSET set to UTF8
SQL> select ascii('Æ') from dual ;
ASCII('?')
----------
15712189
SQL>
SQL> select ascii( unistr('\00C6') ) from dual ;
ASCII(UNISTR('\00C6'))
----------------------
50054
-- on a db with NLS_CHARACTERSET set to AL32UTF8 and NLS_NCHAR_CHARACTERSET set to AL16UTF16
SQL> select ascii('Æ') from dual ;
ASCII('Æ')
----------
14844057
SQL> select ascii( unistr('\00C6') ) from dual ;
ASCII(UNISTR('\00C6'))
----------------------
198