Oracle custom wmsys. Wm_concat avoid length limit search to a similar code but the length of the process or not, after I modify, kiss can be measured, The CREATE OR REPLACE TYPE ZH_CONCAT_IM AUTHID CURRENT_USER AS OBJECT ( CURR_STR CLOB, The STATIC FUNCTION ODCIAGGREGATEINITIALIZE (SCTX OUT ZH_CONCAT_IM) IN RETURN NUMBER, MEMBER FUNCTION ODCIAGGREGATEITERATE (SELF IN OUT ZH_CONCAT_IM, P1 VARCHAR2) IN RETURN NUMBER, The MEMBER FUNCTION ODCIAGGREGATETERMINATE (SELF IN ZH_CONCAT_IM, The RETURNVALUE OUT CLOB, FLAGS IN NUMBER) The RETURN NUMBER, MEMBER FUNCTION ODCIAGGREGATEMERGE (SELF IN OUT ZH_CONCAT_IM, SCTX2 ZH_CONCAT_IM) IN RETURN NUMBER ) GO
The CREATE OR REPLACE TYPE BODY ZH_CONCAT_IM IS The STATIC FUNCTION ODCIAGGREGATEINITIALIZE (SCTX IN OUT ZH_CONCAT_IM) RETURN the NUMBER IS The BEGIN SCTX:=ZH_CONCAT_IM (NULL); RETURN ODCICONST. SUCCESS; END; MEMBER FUNCTION ODCIAGGREGATEITERATE (SELF IN OUT ZH_CONCAT_IM, P1 IN VARCHAR2) RETURN the NUMBER IS The BEGIN IF (CURR_STR IS NOT NULL) THEN CURR_STR:=CURR_STR | | ', '| | P1. The ELSE CURR_STR:=p; END the IF; RETURN ODCICONST. SUCCESS; END; The MEMBER FUNCTION ODCIAGGREGATETERMINATE (SELF IN ZH_CONCAT_IM, The RETURNVALUE OUT CLOB, FLAGS IN NUMBER) RETURN the NUMBER IS The BEGIN The RETURNVALUE:=CURR_STR; RETURN ODCICONST. SUCCESS; END; MEMBER FUNCTION ODCIAGGREGATEMERGE (SELF IN OUT ZH_CONCAT_IM, SCTX2 IN ZH_CONCAT_IM) RETURN the NUMBER IS The BEGIN IF (SCTX2. CURR_STR IS NOT NULL) THEN SELF. CURR_STR:=SELF. CURR_STR | | ', '| | SCTX2. CURR_STR; END the IF; RETURN ODCICONST. SUCCESS; END; END; GO The CREATE OR REPLACE FUNCTION ZH_CONCAT (P1 VARCHAR2) RETURN CLOB AGGREGATE USING ZH_CONCAT_IM;
CodePudding user response:
So ~ your problem is?
CodePudding user response:
Write their own custom function too much trouble, it is ok to use xmlagg, supporting the return clob and type string The select rtrim (xmlagg (xmlparse (the content l | | ', 'wellformed)). Getclobval (),', ')/*. Getstringval () */the from (select level as l from dual connect by level<=5000).