36.141 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;

パラメータ

表36-121 TABLE_TO_STRINGのパラメータ

パラメータ 説明

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;