Oracle 根据汉字返回拼音函数(六)

2014-11-24 18:00:07 · 作者: · 浏览: 3
('xuan', -12039));


PIPE Row(spell_code('xue', -11867));


PIPE Row(spell_code('xun', -11861));


PIPE Row(spell_code('ya', -11847));


PIPE Row(spell_code('yan', -11831));


PIPE Row(spell_code('yang', -11798));


PIPE Row(spell_code('yao', -11781));


PIPE Row(spell_code('ye', -11604));


PIPE Row(spell_code('yi', -11589));


PIPE Row(spell_code('yin', -11536));


PIPE Row(spell_code('ying', -11358));


PIPE Row(spell_code('yo', -11340));


PIPE Row(spell_code('yong', -11339));


PIPE Row(spell_code('you', -11324));


PIPE Row(spell_code('yu', -11303));


PIPE Row(spell_code('yuan', -11097));


PIPE Row(spell_code('yue', -11077));


PIPE Row(spell_code('yun', -11067));


PIPE Row(spell_code('za', -11055));


PIPE Row(spell_code('zai', -11052));


PIPE Row(spell_code('zan', -11045));


PIPE Row(spell_code('zang', -11041));


PIPE Row(spell_code('zao', -11038));


PIPE Row(spell_code('ze', -11024));


PIPE Row(spell_code('zei', -11020));


PIPE Row(spell_code('zen', -11019));


PIPE Row(spell_code('zeng', -11018));


PIPE Row(spell_code('zha', -11014));


PIPE Row(spell_code('zhai', -10838));


PIPE Row(spell_code('zhan', -10832));


PIPE Row(spell_code('zhang', -10815));


PIPE Row(spell_code('zhao', -10800));


PIPE Row(spell_code('zhe', -10790));


PIPE Row(spell_code('zhen', -10780));


PIPE Row(spell_code('zheng', -10764));


PIPE Row(spell_code('zhi', -10587));


PIPE Row(spell_code('zhong', -10544));


PIPE Row(spell_code('zhou', -10533));


PIPE Row(spell_code('zhu', -10519));


PIPE Row(spell_code('zhua', -10331));


PIPE Row(spell_code('zhuai', -10329));


PIPE Row(spell_code('zhuan', -10328));


PIPE Row(spell_code('zhuang', -10322));


PIPE Row(spell_code('zhui', -10315));


PIPE Row(spell_code('zhun', -10309));


PIPE Row(spell_code('zhuo', -10307));


PIPE Row(spell_code('zi', -10296));


PIPE Row(spell_code('zong', -10281));


PIPE Row(spell_code('zou', -10274));


PIPE Row(spell_code('zu', -10270));


PIPE Row(spell_code('zuan', -10262));


PIPE Row(spell_code('zui', -10260));


PIPE Row(spell_code('zun', -10256));


PIPE Row(spell_code('zuo', -10254));


Return;


end;


--------------- 返回函数, 该函数会调用上面的字典函数


create or replace function f_getSpell(p_cnStr In varchar2,


p_sign In number Default Null)


return varchar2 as


lv_spell varchar2(200);


lv_temp Varchar2(10);


lv_char varchar2(10);


lv_bytes varchar2(100);


li_bytes Integer;


li_pos Integer;


begin


if p_cnStr is null then


return '';


end if;


for i In 1 .. length(p_cnStr) loop


lv_char := substr(p_cnStr, i, 1);


if lengthb(lv_char) = 1 then


lv_spell := lv_spell || lv_char;


elsif lengthb(lv_char) = 2 then


Select replace(substrb(dump(lv_char,1010),instrb(dump(lv_char,1010),'ZHS16GBK:')),'ZHS16GBK: ','') Into lv_bytes from dual;


li_pos:=instr(lv_bytes,',');


li_bytes:=substr(lv_bytes,1,li_pos-1)*256+substr(lv_bytes,li_pos+1)-256*256;


Select ascii(lv_char) - 256 * 256 Into li_bytes From dual;


If (li_bytes < -20319 Or li_bytes > -10247) Then


lv_spell := lv_spell || '*';


Else


select max(spell)


Into lv_temp


from table(f_getSpellcode)


where code <= li_bytes;


if p_sign Is Null then


lv_spell := lv_spell || substr(lv_temp, 1, 1);


else


lv_spell := lv_spell || lv_temp;


end if;


End If;


elsif lengthb(lv_char) = 3 then


Select replace(substrb(dump(conve