--注:此函数只在ZHS16GBK字符集的Oracle 9.2中通过,其它平台没有测试,请根据实际需要作相应的修改 create or replace function csound(c in varchar2, op in integer default 1 --加上不等于1的参数,则对全字符串进行处理,支持中英文合编 ) return varchar2 is c1 varchar2(2); c2 varchar2(2); p integer; n1 integer; n2 integer; csound varchar2(32767); begin if op=1 then p:=1 ; else p:=length(c); end if; for i in 1..p loop c2:=substr(c,i,1); n1:=floor(ascii(c2)/256); n2:=mod(ascii(c2),256); if n1=0 and n2<=129 then c1:=c2; elsif n2<>127 and n2<>255 and not (n2 between 0 and 63) then select case when c2>='丂' and c2<'芭' then 'A' when c2>='芭' and c2<'擦' then 'B' when c2>='擦' and c2<'搭' then 'C' when c2>='搭' and c2<'蛾' then 'D' when c2>='蛾' and c2<'发' then 'E' when c2>='发' and c2<'噶' then 'F' when c2>='噶' and c2<'哈' then 'G' when c2>='哈' and c2<'击' then 'H' when c2>='击' and c2<'喀' then 'J' when c2>='喀' and c2<'垃' then 'K' when c2>='垃' and c2<'妈' then 'L' when c2>='妈' and c2<'拿' then 'M' when c2>='拿' and c2<'哦' then 'N'
|