• oracleXE数据库没有公开wm_concat函数, 需要手动添加


    CREATE OR REPLACE TYPE wm_concat_impl
       AUTHID CURRENT_USER
    AS OBJECT (
       curr_str   VARCHAR2 (32767),
       STATIC FUNCTION odciaggregateinitialize (sctx IN OUT wm_concat_impl)
          RETURN NUMBER,
       MEMBER FUNCTION odciaggregateiterate (
          SELF   IN OUT   wm_concat_impl,
          p1     IN       VARCHAR2
       )
          RETURN NUMBER,
       MEMBER FUNCTION odciaggregateterminate (
          SELF          IN       wm_concat_impl,
          returnvalue   OUT      VARCHAR2,
          flags         IN       NUMBER
       )
          RETURN NUMBER,
       MEMBER FUNCTION odciaggregatemerge (
          SELF    IN OUT   wm_concat_impl,
          sctx2   IN       wm_concat_impl
       )
          RETURN NUMBER
    );
    /
     
    CREATE OR REPLACE TYPE BODY wm_concat_impl
    IS
       STATIC FUNCTION odciaggregateinitialize (sctx IN OUT wm_concat_impl)
          RETURN NUMBER
       IS
       BEGIN
          sctx := wm_concat_impl (NULL);
          RETURN odciconst.success;
       END;
       MEMBER FUNCTION odciaggregateiterate (
          SELF   IN OUT   wm_concat_impl,
          p1     IN       VARCHAR2
       )
          RETURN NUMBER
       IS
       BEGIN
          IF (curr_str IS NOT NULL)
          THEN
             curr_str := curr_str || ',' || p1;
          ELSE
             curr_str := p1;
          END IF;
     
          RETURN odciconst.success;
       END;
       MEMBER FUNCTION odciaggregateterminate (
          SELF          IN       wm_concat_impl,
          returnvalue   OUT      VARCHAR2,
          flags         IN       NUMBER
       )
          RETURN NUMBER
       IS
       BEGIN
          returnvalue := curr_str;
          RETURN odciconst.success;
       END;
       MEMBER FUNCTION odciaggregatemerge (
          SELF    IN OUT   wm_concat_impl,
          sctx2   IN       wm_concat_impl
       )
          RETURN NUMBER
       IS
       BEGIN
          IF (sctx2.curr_str IS NOT NULL)
          THEN
             SELF.curr_str := SELF.curr_str || ',' || sctx2.curr_str;
          END IF;
     
          RETURN odciconst.success;
       END;
    END;
    /
     
    CREATE OR REPLACE FUNCTION wm_concat (p1 VARCHAR2)
       RETURN VARCHAR2
       AGGREGATE USING wm_concat_impl;
    /
  • 相关阅读:
    python升级安装后的yum的修复
    leetCode 47.Permutations II (排列组合II) 解题思路和方法
    MySQL源代码解读
    MySQL快速建立测试表
    MySQL登陆小问题
    MySQL查看当前用户、存储引擎、日志
    【博客编辑工具】
    mysql5.7执行sql语句出现only_full_group_by错误
    mysql查询出来的某一列合并成一个字段
    动态生成多选框
  • 原文地址:https://www.cnblogs.com/wgbs25673578/p/7306323.html
Copyright © 2020-2023  润新知