If two nested table variables have the same nested table type, and that nested table type does not have elements of a record type.
Then you can compare the two variables for equality or inequality with the relational operators equal (=) and not equal (<>, !=, ~=, ^=).
Two nested table variables are equal if and only if they have the same set of elements (in any order).
The following code compares nested table variables for equality and inequality.
SQL> SQL> DECLARE-- from w ww . j a va2 s .co m 2 TYPE StringTable IS TABLE OF VARCHAR2(30); -- element type is not record type 3 4 dept_names1 StringTable := StringTable('A','B','C','D'); 5 6 dept_names2 StringTable := StringTable('A','B','C','D'); 7 8 dept_names3 StringTable := StringTable('A','B','C'); 9 10 BEGIN 11 IF dept_names1 = dept_names2 THEN 12 DBMS_OUTPUT.PUT_LINE('dept_names1 = dept_names2'); 13 END IF; 14 15 IF dept_names2 != dept_names3 THEN 16 DBMS_OUTPUT.PUT_LINE('dept_names2 != dept_names3'); 17 END IF; 18 END; 19 / dept_names1 = dept_names2 dept_names2 != dept_names3 PL/SQL procedure successfully completed. SQL>