DECLARE
TYPE NUMLIST IS TABLE OF NUMBER;
N NUMLIST := NUMLIST(10,20,30,40,50,60,70,80,90,100);
TYPE NICKLIST IS TABLE OF VARCHAR2(64) INDEX BY
VARCHAR2(32)
;
NICKNAMES NICKLIST;
BEGIN
N.DELETE(2); -- deletes element 2
N.DELETE(3,6); -- deletes elements 3 through 6
N.DELETE(7,7); -- deletes element 7
N.DELETE(6,3); -- does nothing since 6 > 3
N.DELETE; -- deletes all elements
NICKNAMES('Bob') := 'Robert';
NICKNAMES('Buffy') := 'Esmerelda';
NICKNAMES('Chip') := 'Charles';
NICKNAMES('Dan') := 'Daniel';
NICKNAMES('Fluffy') := 'Ernestina';
NICKNAMES('Rob') := 'Robert';
-- following deletes element denoted by this key
NICKNAMES.DELETE('Chip');
-- following deletes elements with keys in this alphabetic range
NICKNAMES.DELETE('Buffy','Fluffy');
END;
/
Using the DELETE Method on a Collection
0 comments:
Post a Comment