oracle汉字转换成拼音、五笔等
2018-03-04 20:35
1076 查看
select ypmc,ch_code(ypmc,'pyCode',1,8) from yk_typk; 第二个参数:码类型(见下图) 第三个参数:从第几位开始截取 第四个参数:截取最大长度
ch_code函数脚本:CREATE OR REPLACE FUNCTION "CH_CODE" (chStr varchar2,
codeType varchar2,
len Integer,
maxLen Integer) RETURN VARCHAR2 IS
ch VARCHAR2(4);
code varchar2(50);
retStr VARCHAR2(100);
BEGIN
for i in 1 .. length(chStr) loop
ch := substr(chStr, i, 1);
if REGEXP_INSTR(ch, '[a-zA-Z0-9]') > 0 or
(REGEXP_INSTR(asciistr(ch), '[\u4E00-\u9FA5]') > 0 and
substr(asciistr(ch), 1, 1) = '\') then
if REGEXP_INSTR(ch, '[a-zA-Z0-9]') > 0 then
retStr := retStr || ch;
else
begin
execute immediate 'select ' || codeType ||
' from pub_characterencoding t where t.hzcode = :1'
into code
using ch;
retStr := retStr || substr(code, 0, len);
exception
when others then
retStr := '';
end;
end if;
end if;
end loop;
return substr(retStr, 0, maxLen);
exception
when others then
return '';
END;pub_characterencoding 表中的数据:点击打开链接 进行下载
相关文章推荐
- Oracle 根据汉字的首字母转换成拼音
- 汉字,五笔,拼音的转换
- ORACLE 汉字转拼音 在数据库编码为UTF8时 正常转换
- 根据汉字的首字母转换成拼音(oracle)
- PHP里面汉字简繁与拼音转换
- oracle汉字转拼音(获得全拼/拼音首字母/拼音截取等)
- 汉字转换为拼音 (实用的类)
- 转换字符串中汉字为其拼音缩写(C#) .
- python汉字转换拼音
- PHP汉字转换拼音的类
- Android 汉字转换拼音之JPinyin
- 汉字转换拼音(网上找的js库)
- 使用CFStringTransform将汉字转换为拼音
- PHP汉字拼音转换和公历农历转换(代码家园)
- Java下将汉字转换为拼音的包pinyin4j
- [转]汉字转换为拼音
- php中将汉字转换成拼音的函数代码
- js把汉字转换为拼音
- Oracle的汉字转拼音首字母的函数
- c#将中文转换成拼音,以空格隔开,全拼,获取汉字首字母,PinyinHelper