1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| CREATE OR REPLACE FUNCTION F_FANTI_TO_JIANTI(OLD_STRING IN VARCHAR2) RETURN VARCHAR2 AS LENGTH_NUM NUMBER := NULL; OLD_WORD VARCHAR2(500) := NULL; NEW_WORD VARCHAR2(500) := NULL; ZZ_WORD VARCHAR2(500) := NULL; I NUMBER := 0; BEGIN LENGTH_NUM := LENGTH(OLD_STRING); FOR I IN REVERSE 1 .. LENGTH_NUM LOOP OLD_WORD := SUBSTR(OLD_STRING, I, 1); BEGIN SELECT t.simplified INTO NEW_WORD FROM dm_fanti_jianti_7434 T WHERE t.traditional = OLD_WORD; EXCEPTION WHEN NO_DATA_FOUND THEN NEW_WORD := OLD_WORD; END; ZZ_WORD := NEW_WORD || ZZ_WORD; END LOOP; RETURN ZZ_WORD; END;
|