CREATE OR REPLACE FUNCTION f_pinyin (p_name in VARCHAR2) RETURN VARCHAR2 as V_compare VARCHAR2 (100);V_return VARCHAR2 (4000);FUNCTION F_nlssort (P_word in VARCHAR2) return VARCHAR2 as BEGIN return Nlssort (P_word, ' Nls_sort=schinese_pinyin_m ');END;BEGIN for I in1..NVL (LENGTH (p_name), 0) LOOP V_compare:= F_nlssort (SUBSTR (P_name, I, 1));IF v_compare >= f_nlssort (' Acridine ') and V_compare <=f_nlssort (' 驁 ') then V_return:= V_return | | A;elsif v_compare >= f_nlssort (' eight ') and V_compare <=f_nlssort (' book ') then V_return:= V_return | | B;elsif v_compare >= f_nlssort (' Cha ') and V_compare <=f_nlssort (' wrong ') then V_return:= V_return | | C;elsif v_compare >= f_nlssort (' Otah ') and V_compare <=f_nlssort (' 鵽 ') then V_return:= V_return | | D;elsif v_compare >= f_nlssort (' Ehegan ') and V_compare <=f_nlssort (' 樲 ') then V_return:= V_return | | E;elsif v_compare >= f_nlssort (' FA ') and V_compare <=f_nlssort (' 猤 ') then V_return:= V_return | | F;elsif v_compare >= f_nlssort (' Xu ') and V_compare <=f_nlssort (' hiker ') then V_return:= V_return | | G;elsif v_compare >= f_nlssort (' 妎 ') and V_compare <=f_nlssort (' inceѕt ') then V_return:= V_return | | H;elsif v_compare >= f_nlssort (' not ') and V_compare <=f_nlssort (' 攈 ') then V_return:= V_return | | J;elsif v_compare >= f_nlssort (' ka ') and V_compare <=f_nlssort (' 穒 ') then V_return:= V_return | | K;elsif v_compare >= f_nlssort (' junk ') and V_compare <=f_nlssort (' 擽 ') then V_return:= V_return | | L;elsif v_compare >= f_nlssort (' 嘸 ') and V_compare <=f_nlssort (' 椧 ') then V_return:= V_return | | M;elsif v_compare >= f_nlssort (' Hallasan ') and V_compare <=f_nlssort (' malarial ') then V_return:= V_return | | N;elsif v_compare >= f_nlssort (' 筽 ') and V_compare <=f_nlssort (' 漚 ') then V_return:= V_return | | O;elsif v_compare >= f_nlssort (' 妑 ') and V_compare <=f_nlssort (' exposure ') then V_return:= V_return | | P;elsif v_compare >= f_nlssort (' seven ') and V_compare <=f_nlssort (' 裠 ') then V_return:= V_return | | ' Q ';elsif v_compare >= f_nlssort (' Everybody ') and V_compare <=f_nlssort (' 鶸 ') then V_return:= V_return | | R;elsif v_compare >= f_nlssort (' three ') and V_compare <=f_nlssort (' 蜶 ') then V_return:= V_return | | S;elsif v_compare >= f_nlssort (' 侤 ') and V_compare <=f_nlssort (' 籜 ') then V_return:= V_return | | T;elsif v_compare >= f_nlssort (' 屲 ') and V_compare <=f_nlssort (' clamoring ') then V_return:= V_return | | W;elsif v_compare >= F_nlssort (' XI ') and V_compare <=f_nlssort (' 鑂 ') then V_return:= V_return | | X;elsif v_compare >= f_nlssort (' ya ') and V_compare <=F_nlssort (' Wan Leng ') then V_return:= V_return | | Y;elsif v_compare >= f_nlssort (' as ') and V_compare <=f_nlssort (' a ') then V_return:= V_return | | Z;END IF;END LOOP;RETURN V_return;END;
The function of Oracle's first letter of Chinese pinyin