SUBMULTISET: is it a sub set : SUBMULTISET « Collections « Oracle PL/SQL Tutorial






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>








26.13.SUBMULTISET
26.13.1.SUBMULTISET Operator
26.13.2.SUBMULTISET operator checks whether a VARRAY or NESTED TABLE collection is a subset of a mirrored datatype
26.13.3.SUBMULTISET table collection
26.13.4.SUBMULTISET: is it a sub set