Consider the following one-dimensional ARRAY data type and table.
CREATE TYPE phonenumbers AS VARRAY(20) OF CHAR(10); CREATE TABLE employee_info (eno INTEGER, phonelist phonenumbers);
The table is populated with the following values:
/* The first 2 elements are populated; the rest are uninitialized. */ INSERT INTO employee_info VALUES (1, phonenumbers('1112223333', '6195551234')); /* Empty ARRAY instance */ INSERT INTO employee_info VALUES (2, phonenumbers()); /* Update the empty ARRAY instance such that element 3 is set to a value; then elements 1 and 2 are set to NULL, the rest are uninitialized. */ UPDATE employee_info SET phonelist[3] = '8584850000' WHERE id = 2;
The following query returns the number of elements in the phonelist array that contain NULL or values that are non-NULL.
SELECT eno, phonelist.OCOUNT() FROM employee_info;
The following is the result of the query.
ENO phonelist.OCOUNT() --- ------------------ 1 2 (the first 2 elements have values that are non-NULL) 2 3 (the first 3 elements have NULL or values that are non-NULL)