CARDINALITY Operator : CARDINALITY « Collections « Oracle PL/SQL Tutorial






CARDINALITY operator gets the number of elements in a nested table.

SQL>
SQL> CREATE OR REPLACE PROCEDURE cardinality_example AS
  2    TYPE nestedTableType IS TABLE OF VARCHAR2(10);
  3    myTable1 nestedTableType;
  4    cardinality_var INTEGER;
  5  BEGIN
  6    myTable1 := nestedTableType('F', 'G', 'S');
  7    cardinality_var := CARDINALITY(myTable1);
  8    DBMS_OUTPUT.PUT_LINE('cardinality_var = ' || cardinality_var);
  9  END cardinality_example;
 10  /

Procedure created.

SQL> CALL cardinality_example();
cardinality_var = 3

Call completed.

SQL>
SQL>








26.10.CARDINALITY
26.10.1.CARDINALITY Operator
26.10.2.CARDINALITY operator lets count the elements in a collection.
26.10.3.CARDINALITY table collection