Oracle PL/SQL Tutorial/Collections/IS A SET
IS A SET Operator
You use the IS A SET operator to check if the elements in a nested table are distinct.
<source lang="sql">
SQL> CREATE OR REPLACE PROCEDURE is_a_set_example AS
2 TYPE nestedTableType IS TABLE OF VARCHAR2(10); 3 myTable1 nestedTableType; 4 result BOOLEAN; 5 BEGIN 6 myTable1 := nestedTableType("F", "G", "S", "G"); 7 result := myTable1 IS A SET; 8 IF result THEN 9 DBMS_OUTPUT.PUT_LINE("Elements are all unique"); 10 ELSE 11 DBMS_OUTPUT.PUT_LINE("Elements contain duplicates"); 12 END IF; 13 END is_a_set_example; 14 /
Procedure created. SQL> CALL is_a_set_example(); Elements contain duplicates Call completed. SQL> SQL></source>