This article is written about how to use the Oracle/PLSQL CARDINALITY function with syntax and examples.
Description
The Oracle/PLSQL CARDINALITY function returns the number of elements in a nested table.
Syntax
The syntax for the CARDINALITY function in Oracle/PLSQL is:
CARDINALITY( nested_table_column )
Parameters or Arguments
nested_table_column
The column in the nested table that you wish to return the cardinality for.
Returns
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
Example
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;
Leave a Review