Home > Advanced Programming Techni... > Using Collections > Deleting Collection Members
Previous |
Next |
You can delete a collection member by calling the DELETE_MEMBER
procedure and referencing the desired collection member by its sequence ID, for example:
APEX_COLLECTION.DELETE_MEMBER( p_collection_name => collection name, p_seq => member sequence number);
Note that this procedure leaves a gap in the sequence IDs in the specified collection. In addition, calling this procedure causes an error if the named collection does not exist.
You can also delete all members from a collection by when an attribute matches a specific value, for example:
APEX_COLLECTION.DELETE_MEMBERS( p_collection_name => collection name, p_attr_number => number of attribute used to match for the specified attribute value for deletion, p_attr_value => attribute value of the member attribute used to match for deletion);
Note that the DELETE_MEMBERS
procedure also leaves a gap in the sequence IDs in the specified collection. This procedure causes an error if:
The named collection does not exist.
The specified attribute number is outside the range of 1 to 50, or not valid.
If the supplied attribute value is null, then all members of the named collection will be deleted where the attribute (specified by p_attr_number) is null.