CARDINALITY function in Oracle

CARDINALITY is an advanced function that the Oracle database supports. It is used to get the number of elements in a nested table. The CARDINALITY function is supported in the various versions of the Oracle/PLSQL, including, Oracle 12c, Oracle 11g and Oracle 10g.

Syntax:

CARDINALITY( column )

Parameters:
column: It is used to specify the column in the nested table whose cardinality needs to be returned.

Example :

select id, CARDINALITY (marks)
from students;

Explanation:
Here, the cardinality will be returned for the ‘marks’ column in the ‘students’ table.

Please Share