How can i create a function on Oracle like sum, min, max?
it will run on result set.
Select join(',', Name), sum(total) From Account Group By IdCity
Here is a link to the documentation that describes how you can create your own aggregate functions: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10765/aggr_functions.htm
Regards,
Rob.
Use wmsys.wm_concat if Oracle version is 10 or more.
You can also do a lookup on creating aggregate functions in Oracle.
Note that SQLite has the group_concat builtin aggregate if maybe you were interested in it.
Check out the listagg function. It's a solution to your problem (although it doesn't describe how to build your own aggregate function).
来源:https://stackoverflow.com/questions/5430357/oracle-aggregate-for-joining-strings-with-comma-and-about-writing-custom-aggreg