Oracle没有WM_CONCAT函数的解决办法

Oracle没有WM_CONCAT函数的解决办法
WM_CONCAT是oracle的非公开函数,并不鼓励使用,新版本oracle并没有带此函数,需要手工加上。

1、下载三个文件:owmctab.plb 、 owmaggrs.plb 、 owmaggrb.plb

2、用sqlplus登录:sqlplus -logon sys/123 as sysdba

3、执行@C:\Users\JOYTRAVEL\Desktop\WMSYS用户\owmaggrb.plb;

如果执行结果报错,说找不到WMSYS用户,那么执行 @C:\Users\JOYTRAVEL\Desktop\WMSYS用户\owmctab.plb;

再执行owmaggrb和owmaggrs

展开阅读全文

Oracle XE如何添加wm_concat函数

04-22

搜了一下,网上给出的是下面的答案。rn[code=css]CREATE OR REPLACE TYPE wm_concat_implrn AUTHID CURRENT_USERrnAS OBJECT (rn curr_str VARCHAR2 (32767),rn STATIC FUNCTION odciaggregateinitialize (sctx IN OUT wm_concat_impl)rn RETURN NUMBER,rn MEMBER FUNCTION odciaggregateiterate (rn SELF IN OUT wm_concat_impl,rn p1 IN VARCHAR2rn )rn RETURN NUMBER,rn MEMBER FUNCTION odciaggregateterminate (rn SELF IN wm_concat_impl,rn returnvalue OUT VARCHAR2,rn flags IN NUMBERrn )rn RETURN NUMBER,rn MEMBER FUNCTION odciaggregatemerge (rn SELF IN OUT wm_concat_impl,rn sctx2 IN wm_concat_implrn )rn RETURN NUMBERrn);rn/rn rnCREATE OR REPLACE TYPE BODY wm_concat_implrnISrn STATIC FUNCTION odciaggregateinitialize (sctx IN OUT wm_concat_impl)rn RETURN NUMBERrn ISrn BEGINrn sctx := wm_concat_impl (NULL);rn RETURN odciconst.success;rn END;rn MEMBER FUNCTION odciaggregateiterate (rn SELF IN OUT wm_concat_impl,rn p1 IN VARCHAR2rn )rn RETURN NUMBERrn ISrn BEGINrn IF (curr_str IS NOT NULL)rn THENrn curr_str := curr_str || ',' || p1;rn ELSErn curr_str := p1;rn END IF;rn rn RETURN odciconst.success;rn END;rn MEMBER FUNCTION odciaggregateterminate (rn SELF IN wm_concat_impl,rn returnvalue OUT VARCHAR2,rn flags IN NUMBERrn )rn RETURN NUMBERrn ISrn BEGINrn returnvalue := curr_str;rn RETURN odciconst.success;rn END;rn MEMBER FUNCTION odciaggregatemerge (rn SELF IN OUT wm_concat_impl,rn sctx2 IN wm_concat_implrn )rn RETURN NUMBERrn ISrn BEGINrn IF (sctx2.curr_str IS NOT NULL)rn THENrn SELF.curr_str := SELF.curr_str || ',' || sctx2.curr_str;rn END IF;rn rn RETURN odciconst.success;rn END;rnEND;rn/rn rnCREATE OR REPLACE FUNCTION wm_concat (p1 VARCHAR2)rn RETURN VARCHAR2rn AGGREGATE USING wm_concat_impl;rn/[/code]rn但是我放到navicat里运行报错了啊,请问上述代码该如何执行? 论坛

没有更多推荐了,返回首页