# Miscellaneous > Structured Query Language (SQL) >  Thousand separator in SQL Query, with TO_CHAR function gives error in sum function

## muqeem

Hi,

I want to show the amount in a thousand separator format.  I have done it using TO_CHAR but it is limiting me to add two column values. For example below query works fine without thousand separator but gives error otherwise 

"could not be evaluated because of error ORA-01722: invalid number"

=( select 
to_char(sum(unapplied_amount * nvl(a.EXCHANGE_RATE,1)),'999,999,999.99') + 
to_char(sum(on_Account * nvl(a.EXCHANGE_RATE,1)),'999,999,999.99')
from XX_SF_COLLECTION_V a
where a.CUSTOMER_SITE_USE_ID =  :Embarrassment: rder.invoice_to_org_id)

Could anybody suggest a solution

----------

