Skip to content
Advertisement

ORACLE SQL – How to add commas and dollar sign to a table value

For this, I am trying to display my table values in a currency format, here’s my code;

This is what I get;

This is what I want;

So pretty much format the values with a ‘$’ sign and automatically add a ‘,’ where appropriate.

I am very new to this so I apologize if this sounds dumb in any way :p

Advertisement

Answer

This nature can be derived using the NLS setting.

You can alter the NLS_LANGUAGE and NLS_TERRITORY for your session and use the TO_CHAR function to achieve the desired behavior as follows:

You can see current NLS setting using following Views:

  1. NLS_SESSION_PARAMETERS
  2. NLS_DATABASE_PARAMETERS
  3. NLS_INSTANCE_PARAMETERS
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement