DECLARE
TYPE dnames_tab IS TABLE OF VARCHAR2(30);
-- This nested table has some values
dept_names DNAMES_TAB := Dnames_tab('Shipping','Sales','Finance','Payroll');
-- This nested table is not initialized ("atomically null").
empty_set DNAMES_TAB;
BEGIN
-- At first, the initialized variable is not null.
IF dept_names IS NOT NULL THEN
dbms_output.Put_line('OK, at first dept_names is not null.');
END IF;
-- Then we assign a null nested table to it.
dept_names := empty_set;
-- Now it is null.
IF dept_names IS NULL THEN
dbms_output.Put_line('OK, now dept_names has become null.');
END IF;
-- We must use another constructor to give it some values.
dept_names := Dnames_tab('Shipping','Sales','Finance','Payroll');
END;
/
Assigning a Null Value to a Nested Table
0 comments:
Post a Comment