Oracle SQL / PLSQL CARDINALITY function is used to return the number of elements in a nested table.
Oracle SQL / PLSQL syntax for the CARDINALITY function is:
SELECT CARDINALITY (nested_column)
FROM table_name;
nested_column is the column in the nested table whose CARDINALITY we want to determine.
If nested table is empty or is a NULL collection then CARDINALITY function in Oracle SQL / PLSQL will return NULL.
Using Oracle SQL Cardinality Function with SELECT Statement
SELECT employee_id ,CARDINALITY(location) FROM employee;
The example above shows the use of Oracle SQL Cardinality Function with SQL SELCt Statement.