Define Nested Table Type
CREATE OR REPLACE TYPE strings_nt IS TABLE OF VARCHAR2 (100)
Type created.
Exercise SUBMULTISET
DECLARE
steven_authors strings_nt
:= strings_nt ('ROBIN HOBB',
'ROBERT HARRIS',
'DAVID BRIN',
'SHERI S. TEPPER',
'CHRISTOPHER ALEXANDER');
eli_authors strings_nt
:= strings_nt ('SHERI S. TEPPER', 'DAVID BRIN');
null_authors strings_nt
:= strings_nt ();
PROCEDURE bpl (val IN BOOLEAN, text_in IN VARCHAR2)
IS
BEGIN
DBMS_OUTPUT.put_line (text_in || ' ' ||
CASE val
WHEN TRUE THEN 'TRUE'
WHEN FALSE THEN 'FALSE'
ELSE 'NULL'
END);
END bpl;
BEGIN
bpl (steven_authors SUBMULTISET OF eli_authors,
'Father follows son?');
bpl (eli_authors SUBMULTISET OF steven_authors,
'Son follows father?');
bpl (steven_authors NOT SUBMULTISET OF eli_authors,
'Father doesn''t follow son?');
bpl (eli_authors NOT SUBMULTISET OF steven_authors,
'Son doesn''t follow father?');
bpl (steven_authors SUBMULTISET OF null_authors,
'Steven in NULL?');
END;
Father follows son? FALSE
Son follows father? TRUE
Father doesn't follow son? TRUE
Son doesn't follow father? FALSE
Steven in NULL? FALSE