Hitachi

Hitachi Advanced Database SQL Reference


8.12.2 CARDINALITY

Returns the number of array elements in the array data specified for the target data.

Organization of this subsection

(1) Specification format

scalar-function-CARDINALITY::= CARDINALITY(target-data)
 
  target-data::= value-expression

(2) Explanation of specification format

target-data:

Specifies the array data determining the number of array elements

Note the following rules:

(3) Rules

  1. The data type of the execution result is the BIGINT type#.

    #

    If the integer data type format is a legacy format, it will be an INTEGER type.

  2. The NOT NULL constraint does not apply to the value of the execution result (the null value is allowed).

  3. If the target data is a null value, the execution result will be a null value.

(4) Examples

Examples

Determine the number of array elements in each row of the array-type column (column C2) of table T1.

SELECT "C1",CARDINALITY("C2") FROM "T1"

[Figure]