我的数据如下
V1 01/01/2000 $5,000.00
V1 01/02/2001 $10,000.00
预期结果:
V1 5000.00/10,000.00
我使用listagg
,输出结果为:
V1 5000/10000
逗号和比例(.00)丢失。如何使用listagg
或任何其他方法显示金额字段?
答案 0 :(得分:1)
试试这个:
with numbers as
(select 5000 num from dual
union all
select 10000 num from dual)
select listagg(to_char(num, 'fm9G999G999D00', 'NLS_NUMERIC_CHARACTERS = ''.,'''),'/')
within group (order by num) "listing"
from numbers;