Madhav Chakka
Madhav Chakka

Reputation: 1

Display amount fields in one column

I have data as below

V1  01/01/2000  $5,000.00
V1  01/02/2001  $10,000.00

Expected result:

V1  5000.00/10,000.00

I used listagg and the output results in:

V1 5000/10000

The commas and the scale (.00) is lost. How can I achieve to display the amount fields using listagg or any other method?

Upvotes: 0

Views: 63

Answers (1)

a.j. tawleed
a.j. tawleed

Reputation: 904

try this:

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;

Upvotes: 1

Related Questions