函数:
listagg
某个字段多条数据合起来,类似StringUtils.join()
用法:
select listagg (列名, ',') WITHIN GROUP (ORDER BY 列名) as 别名 from 表名 where 条件表达式;
示例:
select listagg(ms.zdmc,'-') WITHIN GROUP (ORDER BY zdbh)
from s_product_plan_site s ,s_merchant_site ms
where s.jhzdlx=2
and s.productplansaletypeid='b046ef1db2494e0dac1cc38f1b8692eb'
and s.merchantsiteid=ms.sitemerchantid
# oracle控制台输出
dbms_output.enable(1000000);
dbms_output.put_line('p_orgId='||p_orgId||' p_saleDate='||p_saleDate||' p_saleType='||p_saleType||' p_type='+p_type);