DECLARE
TYPE dnames_var IS VARRAY(20) OF VARCHAR2(30);
dept_names DNAMES_VAR;
BEGIN
IF dept_names IS NULL THEN
dbms_output.Put_line('Before initialization, the varray is null.');
-- While the varray is null, we cannot check its COUNT attribute.
-- DBMS_OUTPUT.PUT_LINE('It has ' || dept_names.COUNT || ' elements.');
ELSE
dbms_output.Put_line('Before initialization, the varray is not null.');
END IF;
dept_names := Dnames_var(); -- initialize empty varray
IF dept_names IS NULL THEN
dbms_output.Put_line('After initialization, the varray is null.');
ELSE
dbms_output.Put_line('After initialization, the varray is not null.');
dbms_output.Put_line('It has '
||dept_names.COUNT
||' elements.');
END IF;
END;
/
Empty Varray Constructor
0 comments:
Post a Comment