Oracle12G版本不支持wmsys.wm_concat()问题处理,报错连接标识符有误
wm_concat函数不在支持,12C已经隐藏了,只供内部使用,Oracle 11g开始使用listagg替代了wm_concat。所以:
1、建议改写成listagg (强烈建议)
2、手工创建wm_concat函数
CREATE OR REPLACE TYPE WMSYS.WM_CONCAT_IMPL 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 WMSYS.WM_CONCAT_IMPL STATIC FUNCTION ODCIAGGREGATEINITIALIZE(SCTX IN OUT WM_CONCAT_IMPL) RETURN NUMBER BEGIN SCTX := WM_CONCAT_IMPL(NULL) ; RETURN ODCICONST.SUCCESS; MEMBER FUNCTION ODCIAGGREGATEITERATE(SELF IN OUT WM_CONCAT_IMPL,P1 IN VARCHAR2) RETURN NUMBER BEGIN IF(CURR_STR IS NOT NULL) THEN CURR_STR := CURR_STR || ',' || P1; CURR_STR := P1; END IF; RETURN ODCICONST.SUCCESS; MEMBER FUNCTION ODCIAGGREGATETERMINATE(SELF IN WM_CONCAT_IMPL,RETURNVALUE OUT VARCHAR2,FLAGS IN NUMBER) RETURN NUMBER BEGIN RETURNVALUE := CURR_STR ; RETURN ODCICONST.SUCCESS; MEMBER FUNCTION ODCIAGGREGATEMERGE(SELF IN OUT WM_CONCAT_IMPL,SCTX2 IN WM_CONCAT_IMPL) RETURN NUMBER BEGIN IF(SCTX2.CURR_STR IS NOT NULL) THEN SELF.CURR_STR := SELF.CURR_STR || ',' || SCTX2.CURR_STR ; END IF; RETURN ODCICONST.SUCCESS; CREATE OR REPLACE FUNCTION WMSYS.WM_CONCAT(P1 VARCHAR2) RETURN VARCHAR2 AGGREGATE USING WM_CONCAT_IMPL ; create public synonym WM_CONCAT_IMPL for WMSYS.WM_CONCAT_IMPL create public synonym WM_CONCAT for WMSYS.WM_CONCAT