Oracle / PLSQL: CARDINALITY Function

This article is written about how to use the Oracle/PLSQL CARDINALITY function with syntax and examples.


The Oracle/PLSQL CARDINALITY function returns the number of elements in a nested table.


The syntax for the CARDINALITY function in Oracle/PLSQL is:

CARDINALITY( nested_table_column )

Parameters or Arguments


The column in the nested table that you wish to return the cardinality for.


The CARDINALITY function returns a numeric value.

If the nested table is empty, the CARDINALITY function will return NULL.

If the nested table is a null collection, the CARDINALITY function will return NULL.

Applies To

The CARDINALITY function can be used in the following versions of Oracle/PLSQL:

Oracle 12c, Oracle 11g, Oracle 10g


Let’s look at some Oracle CARDINALITY function examples and explore how to use the CARDINALITY function in Oracle/PLSQL.

For example:

select supplier_id, CARDINALITY(location)
from suppliers;