
Checking Whether a Collection Element EXISTS
DECLARE
TYPE numlist IS TABLE OF INTEGER;
n NUMLIST := Numlist(1,3,5,7);
BEGIN
n.DELETE(2); -- Delete the second element
IF n.EXISTS(1) THEN
dbms_output.Put_line('OK, element #1 exists.');
END IF;
IF n.EXISTS(2) = false THEN
dbms_output.Put_line('OK, element #2 has been deleted.');
END IF;
IF n.EXISTS(99) = false THEN
dbms_output.Put_line('OK, element #99 does not exist at all.');
END IF;
END;
/

0 comments:
Post a Comment