以下的文章主要是对Oracle合并函数的两种类型的介绍,即,Oracle9i与Oracle10g相关实际应用代码的介绍,以及Oracle9i的具体使用方案的描述,下面就是文章的具体内容的介绍,望你会有所收获。

成都创新互联网络公司拥有10年的成都网站开发建设经验,上千多家客户的共同信赖。提供网站制作、成都网站设计、网站开发、网站定制、外链、建网站、网站搭建、响应式网站设计、网页设计师打造企业风格,提供周到的售前咨询和贴心的售后服务
Oracle合并函数之9i下:
- create type strcat_type as object (
 - cat_string varchar2(4000),
 - static function ODCIAggregateInitialize(cs_ctx In Out strcat_type) return number,
 - member function ODCIAggregateIterate(self In Out strcat_type,value in varchar2) return number,
 - member function ODCIAggregateMerge(self In Out strcat_type,ctx2 In Out strcat_type) return number,
 - member function ODCIAggregateTerminate(self In Out strcat_type,returnValue Out varchar2,flags in number) return number
 - )
 - /
 - create type body strcat_type is
 - static function ODCIAggregateInitialize(cs_ctx IN OUT strcat_type) return number
 - is
 - begin
 - cs_ctx := strcat_type( null );
 - return ODCIConst.Success;
 - end;
 - member function ODCIAggregateIterate(self IN OUT strcat_type,
 - value IN varchar2 )
 - return number
 - is
 - begin
 - self.cat_string := self.cat_string || ','|| value;
 - return ODCIConst.Success;
 - end;
 - member function ODCIAggregateTerminate(self IN Out strcat_type,
 - returnValue OUT varchar2,
 - flags IN number)
 - return number
 - is
 - begin
 - returnValue := ltrim(rtrim(self.cat_string,','),',');
 - return ODCIConst.Success;
 - end;
 - member function ODCIAggregateMerge(self IN OUT strcat_type,
 - ctx2 IN Out strcat_type)
 - return number
 - is
 - begin
 - self.cat_string := self.cat_string || ',' || ctx2.cat_string;
 - return ODCIConst.Success;
 - end;
 - end;
 - /
 - CREATE or replace
 - FUNCTION strcat(input varchar2 )
 - RETURN varchar2
 - PARALLEL_ENABLE AGGREGATE USING strcat_type;
 - /
 
使用方法:
- select t2.kdm_mdid_pk,t2.kdm_title,
 - strcat(t3.subject_mc_content) message
 - from t_knodoc_rel_subjects t1,
 - T_KNO_DOC_METADATA t2,
 - T_SUBJECT_MULTILINGUAL_CONTENT t3
 - where t1.krs_kdm_mdid_fk=t2.kdm_mdid_pk
 - and t1.krs_subid_fk=t3.subject_mc_id_pk
 - group by t2.kdm_mdid_pk,t2.kdm_title
 
Oracle合并函数之10g下:
- select t2.kdm_mdid_pk,t2.kdm_title,WMSYS.WM_CONCAT(t3.subject_mc_content) message
 - from t_knodoc_rel_subjects t1,
 - T_KNO_DOC_METADATA t2,
 - T_SUBJECT_MULTILINGUAL_CONTENT t3
 - where t1.krs_kdm_mdid_fk=t2.kdm_mdid_pk
 - and t1.krs_subid_fk=t3.subject_mc_id_pk
 - group by t2.kdm_mdid_pk,t2.kdm_title
 
以上的相关内容就是对Oracle合并函数的介绍,望你能有所收获。
【编辑推荐】
Copyright © 2009-2022 www.wtcwzsj.com 青羊区广皓图文设计工作室(个体工商户) 版权所有 蜀ICP备19037934号