DELETE v16
The DELETE
method deletes entries from a collection. You can call the DELETE
method in three different ways.
Removing all entries from a collection
Use this form of the DELETE
method to remove all entries from a collection:
Removing a specified entry from a collection
Use this form of the DELETE
method to remove the specified entry from a collection:
Removing all entries in a range
Use this form of the DELETE
method to remove the entries that fall in the range specified by first_subscript
and last_subscript
(including the entries for the first_subscript
and the last_subscript
) from a collection.
If first_subscript
and last_subscript
refer to elements that don't exist, elements that are in the range between the specified subscripts are deleted. If first_subscript
is greater than last_subscript
, or if you specify a value of NULL
for one of the arguments, DELETE
has no effect.
When you delete an entry, the subscript remains in the collection. You can reuse the subscript with an alternate entry. If you specify a subscript that doesn't exist in the call to the DELETE
method, DELETE
doesn't raise an exception.
Example
This example uses the DELETE
method to remove the element with subscript 0
from the collection:
COUNT
indicates that before the DELETE
method, there were five elements in the collection. After the DELETE
method is invoked, the collection contains four elements.