SQL> SET ECHO ON
SQL>
SQL> CREATE OR REPLACE FUNCTION area_code (phone_number IN VARCHAR2)
2 RETURN VARCHAR2 AS
3 BEGIN
4 IF phone_number LIKE '___-___-____' THEN
5 RETURN SUBSTR(phone_number,1,3);
6 ELSE
7 RETURN 'none';
8 END IF;
9 END;
10 /
Function created.
SQL>