IS EMPTY Operator : IS EMPTY « Collections « Oracle PL/SQL Tutorial






You use the IS EMPTY operator to check if a nested table doesn't contain elements. The following procedure, is_empty_example(), illustrates the use of IS EMPTY:

SQL>
SQL> CREATE OR REPLACE PROCEDURE is_empty_example AS
  2    TYPE nestedTableType IS TABLE OF VARCHAR2(10);
  3    myTable1 nestedTableType;
  4    result BOOLEAN;
  5  BEGIN
  6    myTable1 := nestedTableType('F', 'G', 'S');
  7    result := myTable1 IS EMPTY;
  8    IF result THEN
  9      DBMS_OUTPUT.PUT_LINE('Nested table is empty');
 10    ELSE
 11      DBMS_OUTPUT.PUT_LINE('Nested table contains elements');
 12    END IF;
 13  END is_empty_example;
 14  /

Procedure created.

SQL> CALL is_empty_example();
Nested table contains elements

Call completed.

SQL>
SQL>








26.19.IS EMPTY
26.19.1.IS EMPTY Operator
26.19.2.IS EMPTY operator checks whether a VARRAY or NESTED TABLE collection variable is empty