SUBMULTISET: is it a sub set
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 returnValue := set_in(i)||' ';
6 END LOOP;
7 RETURN returnValue;
8 END format_list;
9 /
Function created.
SQL>
SQL> DECLARE
2 a LIST := list(1,2,3,4);
3 b LIST := list(1,2,3,3,4,5);
4 c LIST := list(1,2,3,3,4,4);
5 BEGIN
6 IF a SUBMULTISET c THEN
7 dbms_output.put_line('[a] is a subset of [c]');
8 END IF;
9 IF NOT b SUBMULTISET c THEN
10 dbms_output.put_line('[b] is not a subset of [c]');
11 END IF;
12 END;
13 /
[a] is a subset of [c]
[b] is not a subset of [c]
PL/SQL procedure successfully completed.
SQL>
Related examples in the same category