汉字首字母转拼音 ascii()

select pinyin('张伟') from dual;

select user_id,username from t_user order by pinyin(username)  按首字母排序

create or replace
function pinyin(hz in varchar2) return varchar2 is
zm varchar2(1);
tmp integer;
begin
    select ascii(hz) into tmp from dual;
    case
    when tmp>=45217 and tmp<=45252 then zm:='a';
    when tmp>=45253 and tmp<=45760 then zm:='b';
    when tmp>=45761 and tmp<=46317 then zm:='c';
    when tmp>=46318 and tmp<=46825 then zm:='d';
    when tmp>=46826 and tmp<=47009 then zm:='e';
    when tmp>=47010 and tmp<=47296 then zm:='f';
    when tmp>=47297 and tmp<=47613 then zm:='g';
    when tmp>=47614 and tmp<=48118 then zm:='h';
    when tmp>=48119 and tmp<=49061 then zm:='j';
    when tmp>=49062 and tmp<=49323 then zm:='k';
    when tmp>=49324 and tmp<=49895 then zm:='l';
    when tmp>=49896 and tmp<=50370 then zm:='m';
    when tmp>=50371 and tmp<=50613 then zm:='n';
    when tmp>=50614 and tmp<=50621 then zm:='o';
    when tmp>=50622 and tmp<=50905 then zm:='p';
    when tmp>=50906 and tmp<=51386 then zm:='q';
    when tmp>=51387 and tmp<=51445 then zm:='r';
    when tmp>=51446 and tmp<=52217 then zm:='s';
    when tmp>=52218 and tmp<=52697 then zm:='t';
    when tmp>=52698 and tmp<=52979 then zm:='w';
    when tmp>=52980 and tmp<=53640 then zm:='x';
    when tmp>=53689 and tmp<=54480 then zm:='y';
    when tmp>=54481 and tmp<=62289 then zm:='z';
    else zm:='0';  --字符0表示非汉字,不处理

    end case;
    return zm;
end pinyin;

 

ASP.NET(C#)汉字转换成拼音的源代码    http://www.son1c.cn/show/382.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值