|
用nchar跳过了xe的bug
SQL> select ascii(convert(substr('融自春',3,1),'ZHS16GBK')) from dual;
ASCII(CONVERT(SUBSTR('融自春',3,1),'ZHS16GBK'))
-----------------------------------------------
180
SQL> select ascii(convert(substr(to_nchar('融自春'),3,1),'ZHS16GBK')) from dual;
ASCII(CONVERT(SUBSTR(TO_NCHAR('融自春'),3,1),'ZHS16GBK'))
---------------------------------------------------------
46266
with tmp
as(select to_nchar('春节快乐') hz from dual),
tmp2
as(select level n from tmp connect by level <=length(hz)),
tmp3
as(
select n,l,substr(dbms_lob.substr(bin_data,32,(94*(trunc(
ascii(convert(substr(hz,n,1),'ZHS16GBK' ))/256)-161)+
(mod(
ascii(convert(substr(hz,n,1),'ZHS16GBK')),256)-161))*32+1),l*4-3,4) line from
char_image,tmp,tmp2,
(select level l from dual connect by level<=16)),
tmp4
as(
select n,l,to_number(substr(line,1,1),'X')a,to_number(substr(line,2,1),'X')b,
to_number(substr(line,3,1),'X')c,to_number(substr(line,4,1),'X')e from tmp3)
select --n,l,a,b,c,e,
replace(replace(
to_char(
(floor(a/8)||mod(floor(a/4),2)||mod(floor(a/2),2)||mod(a,2))*1E12+
(floor(b/8)||mod(floor(b/4),2)||mod(floor(b/2),2)||mod(b,2))*1E8+
(floor(c/8)||mod(floor(c/4),2)||mod(floor(c/2),2)||mod(c,2))*1E4+
(floor(e/8)||mod(floor(e/4),2)||mod(floor(e/2),2)||mod(e,2)),'09999999999999999'),
'0',' '),'1','WW') hh from tmp4
order by n,l;
祝春节快乐
|
|