CAST_TO_RAW
select value from v$nls_parameters where parameter = 'NLS_CHARACTERSET';
--
-- AL32UTF8
begin
dbms_output.put_line(
regexp_replace(
utl_raw.cast_to_raw('René'),
'(..)', '\1 '
)
);
end;
/
--
-- 52 65 6E C3 A9
utl_raw.cast_to_raw
takes into account the current value of
nls_characterset
. With
AL32UTF8
(which is essentially
UTF-8), the value for é is 0xc3a9.
If I executed the same PL/SQL block in an environment where the value of nls_characterset
is WE8MSWIN1252
, the block would print 52 65 6E E9
.