汉字首字母转拼音 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

你可能感兴趣的:(C++,c,C#,asp.net,asp)