SQL>
SQL> CREATE OR REPLACE TYPE list IS TABLE OF NUMBER;
2 /
Type created.
SQL>
SQL> CREATE OR REPLACE FUNCTION format_list(set_in LIST) RETURN VARCHAR2 IS
2 returnValue VARCHAR2(2000);
3 BEGIN
4 FOR i IN set_in.FIRST..set_in.LAST LOOP
5 IF i = set_in.FIRST THEN
6 IF set_in.COUNT = 1 THEN
7 returnValue := set_in(i);
8 ELSE
9 returnValue := ':'||set_in(i);
10 END IF;
11 ELSIF i <> set_in.LAST THEN
12 returnValue := returnValue||', '||set_in(i);
13 ELSE
14 returnValue := returnValue||', '||set_in(i)||')';
15 END IF;
16 END LOOP;
17 RETURN returnValue;
18 END format_list;
19 /
Function created.
SQL>
|