Oracle wm_concat (column) function in Oracle data, use the wm_concat (column) function, you can merge the selected field data values; 1. merge a single field value, for example: SQL: select t. id, t. name, t. price, t. count, t. uid from goods t; the fields are: id, name, price, quantity, and purchaser Id. query the various commodities purchased by the purchaser. SQL: select t. uid, wm_concat (t. name) from goods t group by t. uid; 2. Merge the combined field values, for example, SQL: select t. id, t. name, t. price, t. count, t. uid from goods t; query the various items purchased by the purchaser and their quantity. SQL: select t. uid, wm_concat (t. name | '(' | t. count | ') goods_num from goods group by t. uid; 3. Define the UDF first and then call the UDF. Pay attention to the parameter example: query the various products purchased by a purchaser. create or replace function CONCAT_NAME (UID VARCHAR2) return VARCHAR2 is comms VARCHAR2 (2000) DEFAULT ''; begin for comm in (select t. name from goods t where t. uid = UID) loop comms: = COMMS | COMM. name | '; end LOOP; return COMMS; end;