59.151 TABLE_TO_STRINGファンクション(非推奨)

ノート:

この関数は非推奨です。かわりにJOINファンクションおよびJOIN_CLOBファンクションを使用することをお薦めします。

型がAPEX_APPLICATION_GLOBAL.VC_ARR2のPL/SQL表が指定されると、このファンクションは、指定されたセパレータまたはデフォルトのセパレータ(コロン(:))で区切られた文字列を戻します。

構文

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

パラメータ

パラメータ 説明
p_string 文字列のセパレータ。デフォルト・セパレータはコロン(:)
p_table 区切られた文字列に変換されるPL/SQL表

次の例では、指定された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;