1 FUNCTION Iec_GetPhoneCountryCodeDisplay(p_phone_country_code IN NUMBER)
2 RETURN VARCHAR2
3 IS
4 l_display_str VARCHAR2(4000);
5 l_country_col SYSTEM.varchar_tbl_type;
6 BEGIN
7
8 IF p_phone_country_code = 1 THEN
9
10 SELECT TERRITORY_SHORT_NAME
11 BULK COLLECT INTO l_country_col
12 FROM FND_TERRITORIES_VL
13 WHERE TERRITORY_CODE IN ('US', 'CA')
14 ORDER BY TERRITORY_SHORT_NAME;
15
16 l_display_str := '1 - (North American Numbering Plan - '
17 || l_country_col(1)
18 || ', ' || l_country_col(2) || ')';
19 RETURN l_display_str;
20 END IF;
21
22 SELECT TERRITORY_SHORT_NAME
23 BULK COLLECT INTO l_country_col
24 FROM FND_TERRITORIES_VL A, HZ_PHONE_COUNTRY_CODES B
25 WHERE A.TERRITORY_CODE = B.TERRITORY_CODE
26 AND B.PHONE_COUNTRY_CODE = p_phone_country_code
27 ORDER BY TERRITORY_SHORT_NAME;
28
29 l_display_str := p_phone_country_code;
30 IF l_country_col IS NOT NULL AND l_country_col.COUNT > 0 THEN
31 l_display_str := l_display_str || ' - (' || l_country_col(1);
32 FOR i IN 2..l_country_col.LAST LOOP
33 l_display_str := l_display_str || ', ' || l_country_col(i);
34 END LOOP;
35 l_display_str := l_display_str || ')';
36 END IF;
37
38 RETURN l_display_str;
39 END;