48.147 TABLE_TO_STRING Function (Deprecated)

Note:

This function is deprecated. Oracle recommends using the JOIN and JOIN_CLOB functions instead.

Given a a PL/SQL table of type APEX_APPLICATION_GLOBAL.VC_ARR2, this function returns a delimited string separated by the supplied separator, or by the default separator, a colon (:).

Syntax

APEX_UTIL.TABLE_TO_STRING (
    p_table     IN      apex_application_global.vc_arr2,
    p_string    IN      VARCHAR2 DEFAULT ':' )
RETURN VARCHAR2;

Parameters

Table 48-125 TABLE_TO_STRING Parameters

Parameter Description
p_string String separator. Default separator is a colon (:).
p_table PL/SQL table that is to be converted into a delimited string.

Example

The following example returns a comma delimited string of contact names that are associated with the provided cust_id.

create or replace function get_contacts (
    p_cust_id  in  number )
    return varchar2
is
    l_vc_arr2   apex_application_global.vc_arr2;
    l_contacts  varchar2(32000);

BEGIN

    select contact_name
        bulk collect
        into l_vc_arr2
        from contacts
    where cust_id = p_cust_id
        order by contact_name;

    l_contacts :=  apex_util.table_to_string (
                       p_table => l_vc_arr2,
                       p_string => ', ');

   return l_contacts;

END get_contacts;