oracle汉字转拼音

  • Post author:
  • Post category:其他


oracle汉字转拼音(获得全拼/拼音首字母/拼音截取等)

1.获得全拼

SELECT GETHZPY.GETHZFULLPY(‘拼音’) FROM DUAL;

结果 : PinYin

2.拼音首字母

SELECT GETHZPY.GETHZPYCAP(‘拼音’) FROM DUAL;

结果 : PY

3.拼音截取等

SELECT GETHZPY.GETHZPYCAPSUBSTR(‘拼音’, 0, 1) FROM DUAL;

结果 : P

4、全部汉字判断

select case when trim(pi.patientname)=to_multi_byte(trim(pi.patientname)) then ‘全是汉字’||’ ‘||pi.patientname  else pi.patientname end

from patientinformation pi

where pi.barcode=’37296053′

;

5、名 姓

select INITCAP(GETHZPY.GETHZFULLPY(substr(‘姓测试’,2))) ||’ ‘||INITCAP(GETHZPY.GETHZFULLPY(substr(‘姓测试’,1,1))) from dual;



版权声明:本文为goto1997原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。