See
"User-Defined Aggregate Functions"
in "Oracle9i Data Cartridge Developer's Guide"
http://download-west.oracle.com/docs...5/dci11agg.htm
You should create a type, e.g.:
CREATE TYPE my_agg
AS OBJECT (
string_value VARCHAR2(4000)
)
with all the 4 member functions as mentioned in docs.
You will just make some modifications, e.g. in following member function,
you would write:
---------------------
MEMBER FUNCTION ODCIAggregateIterate(
self IN OUT my_agg,
p_value IN VARCHAR2)
RETURN NUMBER IS
BEGIN
self.string_value:=
self.string_value||','||p_value;
RETURN ODCIConst.Success;
END ODCIAggregateIterate;
--------------------------
After modifications in memeber functions, create a function:
---------
CREATE OR REPLACE FUNCTION my_agg_char(p_char_value IN VARCHAR2)
RETURN VARCHAR2
PARALLEL_ENABLE AGGREGATE USING my_agg;
---------
And then, just use it:
SELECT my_agg_char(col1)
FROM my_table