[计算机软件及应用]oracle中文字符转换拼音.doc
《[计算机软件及应用]oracle中文字符转换拼音.doc》由会员分享,可在线阅读,更多相关《[计算机软件及应用]oracle中文字符转换拼音.doc(143页珍藏版)》请在三一办公上搜索。
1、该函数利用了oracle提供的NLSSORT,具有以下特点:1. 不需要中文字库2. 与数据库字符集无关3. 支持Oracle 9i 及以上版本4. 根据参数可分别返回全拼小写、全拼大写、全拼首字母大写,首字母小写、首字母大写5. 不考虑多音字拼音上下文语义的正确性6. 在2G内存、XP、10.2.0.1 上对3万中文返回拼音用时1.2秒CREATE OR REPLACE FUNCTION fn_getpy (p_str IN VARCHAR2, p_flag NUMBER DEFAULT NULL) RETURN VARCHAR2AS v_compare VARCHAR2 (4); v_re
2、turn VARCHAR2 (4000); v_length INT := 0; v_substr VARCHAR2 (4); FUNCTION fn_nlssort (p_word IN VARCHAR2) RETURN VARCHAR2 AS BEGIN RETURN SUBSTR (NLSSORT (p_word, nls_sort=schinese_pinyin_m), 1, 4); END fn_nlssort;BEGIN IF p_str IS NULL THEN RETURN ; END IF; v_length := LENGTH (p_str); CASE p_flag WH
3、EN 1 THEN -全拼大写 FOR i IN 1 . v_length LOOP v_substr := SUBSTR (p_str, i, 1); v_compare := fn_nlssort (v_substr); CASE WHEN v_compare BETWEEN 3B29 AND 3B30 THEN v_return := v_return | A; WHEN v_compare = 3B31 THEN v_return := v_return | AES; WHEN v_compare BETWEEN 3B32 AND 3B9E THEN v_return := v_ret
4、urn | AI; WHEN v_compare BETWEEN 3BA0 AND 3BFE THEN v_return := v_return | AN; WHEN v_compare BETWEEN 3C01 AND 3C14 THEN v_return := v_return | ANG; WHEN v_compare BETWEEN 3C15 AND 3C82 THEN v_return := v_return | AO; WHEN v_compare BETWEEN 3C84 AND 3CE9 THEN v_return := v_return | BA; WHEN v_compar
5、e BETWEEN 3CED AND 3D1D THEN v_return := v_return | BAI; WHEN v_compare BETWEEN 3D20 AND 3D64 THEN v_return := v_return | BAN; WHEN v_compare BETWEEN 3D66 AND 3DA2 THEN v_return := v_return | BANG; WHEN v_compare BETWEEN 3DA4 AND 3E10 THEN v_return := v_return | BAO; WHEN v_compare = 3E11 THEN v_ret
6、urn := v_return | BE; WHEN v_compare BETWEEN 3E12 AND 3E7A THEN v_return := v_return | BEI; WHEN v_compare BETWEEN 3E7C AND 3EA0 THEN v_return := v_return | BEN; WHEN v_compare BETWEEN 3EA1 AND 3ED5 THEN v_return := v_return | BENG; WHEN v_compare BETWEEN 3ED8 AND 3FE9 THEN v_return := v_return | BI
7、; WHEN v_compare BETWEEN 3FEA AND 4055 THEN v_return := v_return | BIAN; WHEN v_compare BETWEEN 4058 AND 40AE THEN v_return := v_return | BIAO; WHEN v_compare = 4060 THEN v_return := v_return | BIA; WHEN v_compare BETWEEN 40B4 AND 40D4 THEN v_return := v_return | BIE; WHEN v_compare BETWEEN 40D6 AND
8、 4116 THEN v_return := v_return | BIN; WHEN v_compare BETWEEN 4118 AND 4160 THEN v_return := v_return | BING; WHEN v_compare BETWEEN 4161 AND 4224 THEN v_return := v_return | BO; WHEN v_compare BETWEEN 4225 AND 427C THEN v_return := v_return | BU; WHEN v_compare BETWEEN 427D AND 4289 THEN v_return :
9、= v_return | CA; WHEN v_compare BETWEEN 428C AND 42B5 THEN v_return := v_return | CAI; WHEN v_compare BETWEEN 42B9 AND 430C THEN v_return := v_return | CAN; WHEN v_compare BETWEEN 430D AND 4334 THEN v_return := v_return | CANG; WHEN v_compare BETWEEN 4335 AND 435C THEN v_return := v_return | CAO; WH
10、EN v_compare BETWEEN 435D AND 438C THEN v_return := v_return | CE; WHEN v_compare BETWEEN 4390 AND 4398 THEN v_return := v_return | CEN; WHEN v_compare BETWEEN 439D AND 43AA THEN v_return := v_return | CENG; WHEN v_compare = 43AC THEN v_return := v_return | CEOK; WHEN v_compare = 43AE THEN v_return
11、:= v_return | CEOM; WHEN v_compare = 43B0 THEN v_return := v_return | CEON; WHEN v_compare = 43B1 THEN v_return := v_return | CEOR; WHEN v_compare BETWEEN 43B2 AND 440A THEN v_return := v_return | CHA; WHEN v_compare BETWEEN 440E AND 442D THEN v_return := v_return | CHAI; WHEN v_compare BETWEEN 4431
12、 AND 44E1 THEN v_return := v_return | CHAN; WHEN v_compare BETWEEN 44E4 AND 4552 THEN v_return := v_return | CHANG; WHEN v_compare BETWEEN 4554 AND 458E THEN v_return := v_return | CHAO; WHEN v_compare BETWEEN 4590 AND 45C8 THEN v_return := v_return | CHE; WHEN v_compare BETWEEN 45C9 AND 463D THEN v
13、_return := v_return | CHEN; WHEN v_compare BETWEEN 463E AND 46CD THEN v_return := v_return | CHENG; WHEN v_compare BETWEEN 46CE AND 47A6 THEN v_return := v_return | CHI; WHEN v_compare BETWEEN 47A8 AND 47EC THEN v_return := v_return | CHONG; WHEN v_compare BETWEEN 47ED AND 484C THEN v_return := v_re
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机软件及应用 计算机软件 应用 oracle 中文 字符 转换 拼音
链接地址:https://www.31ppt.com/p-4561621.html