Examine the code in the following PL/SQL block:
DECLARE
TYPE NumList IS TABLE OF INTEGER;
List1 NumList := NumList(11,22,33,44);
BEGIN
List1.DELETE(2);
DBMS_OUTPUT.PUT_LINE
( ‘The last element# in List1 is ‘ || List1.LAST ||
‘ and total of elements is ‘||List1.COUNT);
List1.EXTEND(4,3);
END;
/
Which two statements are true about the above code? (Choose two.)
A.
LAST and COUNT give different values.
B.
LAST and COUNT give the same values.
C.
The four new elements that are added contain the value 33.
D.
The four new elements that are added contain the value 44.
A,C
if you delete elements from the middle of a nested table, COUNT is smaller than LAST
If EXTEND encounters deleted elements, it includes them in its tally.
If TRIM encounters deleted elements, it includes them in its tally.
If an element to be deleted does not exist, DELETE simply skips it; no exception is raised. Varrays are dense, so you cannot delete their individual elements. Because PL/SQL keeps placeholders for deleted elements(but not count it when calling .count), you can replace a deleted element by assigning it a new value. However, PL/SQL does not keep placeholders for trimmed elements.