zoukankan      html  css  js  c++  java
  • Oracle 拼接字符串

    Tom大神写的

    CREATE OR REPLACE FUNCTION stragg(input varchar2) RETURN varchar2
      PARALLEL_ENABLE
      AGGREGATE USING string_agg_type;
    --1
    
     
    
    CREATE OR REPLACE TYPE "STRING_AGG_TYPE" as object
    (
      total varchar2(4000),
      static function ODCIAggregateInitialize(sctx IN OUT string_agg_type)
        return number,
      member function ODCIAggregateIterate(self  IN OUT string_agg_type,
                                           value IN varchar2) return number,
      member function ODCIAggregateTerminate(self        IN string_agg_type,
                                             returnValue OUT varchar2,
                                             flags       IN number)
        return number,
      member function ODCIAggregateMerge(self IN OUT string_agg_type,
                                         ctx2 IN string_agg_type) return number
    )
    --2
    create or replace type body string_agg_type is
      static function ODCIAggregateInitialize(sctx IN OUT string_agg_type)
        return number is
      begin
        sctx := string_agg_type(null);
        return ODCIConst.Success;
      end;
      member function ODCIAggregateIterate(self  IN OUT string_agg_type,
                                           value IN varchar2) return number is
      begin
        self.total := self.total || ',' || value;
        return ODCIConst.Success;
      end;
      member function ODCIAggregateTerminate(self        IN string_agg_type,
                                             returnValue OUT varchar2,
                                             flags       IN number) return number is
      begin
        returnValue := ltrim(self.total, ',');
        return ODCIConst.Success;
      end;
      member function ODCIAggregateMerge(self IN OUT string_agg_type,
                                         ctx2 IN string_agg_type) return number is
      begin
        self.total := self.total || ctx2.total;
        return ODCIConst.Success;
      end;
    end;
  • 相关阅读:
    NHibernate介绍
    dwr配置文件dwr.xml详解
    架构设计师与SOA
    SOA是什么
    JDK常用命令
    在WPF的WebBrowser控件中抑制脚本错误
    通过编程计算一个游戏的胜率
    在C#中模拟大数乘法
    解决HttpWebRequest首次连接特别慢的问题
    布隆过滤器(Bloom Filter)
  • 原文地址:https://www.cnblogs.com/huanghongbo/p/8177125.html
Copyright © 2011-2022 走看看