8.23 ADD_MEMBER Function

Use this function to add a new member to an existing collection. Calling this function returns the sequence ID of the newly added member. An error is raised if the specified collection does not exist for the current user in the same session for the current Application ID. Gaps are not used when adding a new member, so an existing collection with members of sequence IDs (1,2,5,8) adds the new member with a sequence ID of 9.

Syntax

APEX_COLLECTION.ADD_MEMBER (
    p_collection_name IN VARCHAR2,
    p_c001 IN VARCHAR2 DEFAULT NULL,
    ...
    p_c050 IN VARCHAR2 DEFAULT NULL,
    p_n001 IN NUMBER DEFAULT NULL,
    p_n002 IN NUMBER DEFAULT NULL,
    p_n003 IN NUMBER DEFAULT NULL,
    p_n004 IN NUMBER DEFAULT NULL,
    p_n005 IN NUMBER DEFAULT NULL,
    p_d001 IN DATE DEFAULT NULL,
    p_d002 IN DATE DEFAULT NULL,
    p_d003 IN DATE DEFAULT NULL,
    p_d004 IN DATE DEFAULT NULL,
    p_d005 IN DATE DEFAULT NULL,
    p_clob001 IN CLOB DEFAULT EMPTY_CLOB(),
    p_blob001 IN BLOB DEFAULT EMPTY_BLOB(),
    p_xmltype001 IN XMLTYPE DEFAULT NULL,
    p_generate_md5 IN VARCHAR2 DEFAULT 'NO')
RETURN NUMBER;

Parameters

Note:

Any character attribute exceeding 4,000 characters is truncated to 4,000 characters.

Table 8-2 ADD_MEMBER Function Parameters

Parameter Description

p_collection_name

The name of an existing collection. Maximum length is 255 bytes. Collection names are not case sensitive and are converted to upper case.

p_c001 through p_c050

Attribute value of the member to be added. Maximum length is 4,000 bytes. Any character attribute exceeding 4,000 characters is truncated to 4,000 characters.

p_n001 through p_n005

Attribute value of the numeric attributes to be added.

p_d001 through p_d005

Attribute value of the date attribute to be added.

p_clob001

Use p_clob001 for collection member attributes that exceed 4,000 characters.

p_blob001

Use p_blob001 for binary collection member attributes.

p_xmltype001

Use p_xmltype001 to store well-formed XML.

p_generate_md5

Valid values include YES and NO. YES to specify if the message digest of the data of the collection member should be computed. Use this parameter to compare the MD5 of the collection member with another member or to see if that member has changed.

Example

DECLARE
    l_seq number;
BEGIN
    l_seq := APEX_COLLECTION.ADD_MEMBER(
                 p_collection_name => 'GROCERIES'
                 p_c001            => 'Grapes',
                 p_c002            => 'Imported',
                 p_n001            => 125,
                 p_d001            => sysdate );
END;