1010),
instrb(dump(convert(lv_char, 'ZHS16GBK', 'UTF8'),
1010),
'UTF8:')),
'UTF8: ',
'')
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;
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;
end if;
end loop;
return lv_spell;
end;
--------------示例:
SQL> select f_getspell('安徽理工大学') from dual;
F_GETSPELL('安徽理工大学')
------------------------------------------------------------------------------
ahlgdx
SQL> select f_getspell('安徽理工大学',1) from dual;
F_GETSPELL('安徽理工大学',1)
----------------------------------------------------------------------------
anhuiligongdaxue