2

I try to make TOTAL_MONEY to this format "123,456,789" (with commas).

select entity_id,
       'the sum is:' || to_char(TOTAL_MONEY, ',') as text_msg
from(
select entity_id,
       sum(volume) as TOTAL_MONEY
from procurement) t

but it doesn't work. I don't find here something useful.

Can you help me with that?

0

2 Answers 2

1

Yet another, simpler solution:

select
  entity_id,
  to_char(TOTAL_MONEY, '"the sum is: "FM999,999,999,999') as text_msg
from(
  select entity_id, sum(volume) as TOTAL_MONEY
  from procurement) t

There are: 'FM' option to remove unnecessary spaces; "double-quoted string" to print it as-is without replacements of any patterns/placeholders.

Sign up to request clarification or add additional context in comments.

Comments

1
    select entity_id,
    'the sum is:' || ltrim(rtrim(to_char(TOTAL_MONEY, '999,999,999,999'))) as text_msg
    from(
          select entity_id,
          sum(volume) as TOTAL_MONEY
          from procurement
        ) t

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.