ANSI Support for Nested Tables : Nested Tables « Collections « Oracle PL/SQL Tutorial






Equal and Not-Equal Operators

You use the equal (=) and not-equal (<>) operators to compare nested tables.

Two nested tables are considered equal when they satisfy all the following conditions:

All the tables are the same type.

All the tables are the same cardinality-that is, they contain the same number of elements.

All the elements are equal.

SQL>
SQL> CREATE OR REPLACE PROCEDURE equal_example AS
  2    TYPE nestedTableType IS TABLE OF VARCHAR2(10);
  3    myTable1 nestedTableType;
  4    myTable2 nestedTableType;
  5    myTable3 nestedTableType;
  6    result BOOLEAN;
  7  BEGIN
  8    myTable1 := nestedTableType('A', 'F', 'G');
  9    myTable2 := nestedTableType('B', 'E', 'H');
 10    myTable3 := nestedTableType('C', 'D', 'I');
 11
 12    result := myTable1 = myTable2;
 13    IF result THEN
 14      DBMS_OUTPUT.PUT_LINE('myTable1 equal to myTable2' );
 15    END IF;
 16
 17    result := myTable1 <> myTable3;
 18    IF result THEN
 19      DBMS_OUTPUT.PUT_LINE('myTable1 not equal to myTable3');
 20    END IF;
 21  END equal_example;
 22  /

Procedure created.

SQL>
SQL> CALL equal_example();
myTable1 not equal to myTable3

Call completed.

SQL>








26.8.Nested Tables
26.8.1.Nested Tables
26.8.2.Deleting internal elements from a collection
26.8.3.Creating a Nested Table Type
26.8.4.ANSI Support for Nested Tables
26.8.5.Nested type column
26.8.6.Insert value into table with nested type colunm
26.8.7.cardinality
26.8.8.Table with subquery
26.8.9.Type alias for user-defined type in select statement