Using EXISTS
The EXISTS(n) returns TRUE if the nth element in a collection exist. Or else, EXISTS(n) returns FALSE. Primarily, you use EXISTS with DELETE to maintain the sparse nested tables. You can also use EXISTS to avoid raising an exception whenever you reference a nonexistent element. In the example below, the PL/SQL executes the assignment statement only if the element i exists:
IF courses.EXISTS(i) THEN courses(i) := new_course; END IF;
When passed an out-of-range subscript, the EXISTS returns FALSE instead of raising SUBSCRIPT_OUTSIDE_LIMIT.