DECLARE
TYPE courselist IS TABLE OF VARCHAR2(10);
courses COURSELIST;
BEGIN
courses := Courselist('Biol 4412','Psyc 3112','Anth 3001');
courses.DELETE(courses.LAST); -- delete element 3
/* At this point, COUNT equals 2, the number of valid
elements remaining. So, you might expect the next
statement to empty the nested table by trimming
elements 1 and 2. Instead, it trims valid element 2
and deleted element 3 because TRIM includes deleted
elements in its tally. */
courses.TRIM(courses.COUNT);
dbms_output.Put_line(Courses(1)); -- prints 'Biol 4412'
END;
/

Using TRIM on Deleted Elements
0 comments:
Post a Comment