找不到任何问题,但它编译时出错。有人看到我对什么视而不见吗?
CREATE OR REPLACE FUNCTION myusername.fun_hr_format_phone (tmp in VARCHAR2) RETURN VARCHAR2
IS tmpVar VARCHAR2(12);
BEGIN
SELECT DECODE(
LENGTH(tmp),
10, SUBSTR(tmp,1,3) || '-' || SUBSTR(tmp,4,3) || '-' || SUBSTR(tmp,7,4),
7, SUBSTR(tmp,1,3) || '-' || SUBSTR(tmp,4,4), tmp
) INTO tmpVar FROM dual;
RETURN tmpVar;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
WHEN OTHERS THEN RAISE;
END;
/