SQL> ed
Wrote file afiedt.buf
1 with x as (select 'Fred' as txt from dual)
2 --
3 ,t as (select txt, regexp_substr(dump(txt),'[0-9,]*$') as bytes from x)
4 ,s as (select txt, rownum rn, to_number(regexp_substr(bytes,'[^,]+',1,rownum)) as byte
5 from t
6 connect by rownum <= length(regexp_replace(bytes,'[^,]*'))+1
7 )
8 ,b as (select txt, rn, byte, to_char(byte, 'fm0x') as hx
9 ,bitand(byte,128)/128||
10 bitand(byte,64)/64||
11 bitand(byte,32)/32||
12 bitand(byte,16)/16||
13 bitand(byte,8)/8||
14 bitand(byte,4)/4||
15 bitand(byte,2)/2||
16 bitand(byte,1) as bin
17 from s)
18 --
19 select txt
20 ,ltrim(sys_connect_by_path(byte,','),',') as bytes
21 ,replace(sys_connect_by_path(bin,','),',') as bin
22 ,replace(sys_connect_by_path(hx,','),',') as hx
23 from b
24 where connect_by_isleaf = 1
25 connect by rn = prior rn + 1
26* start with rn = 1
SQL> /
TXT BYTES BIN HX
---- ------------------------------ ---------------------------------------- --------------------
Fred 70,114,101,100 01000110011100100110010101100100 46726564
SQL>