Software Engineer
Software Engineer

Reputation: 481

oracle sql developer changing currency

Can I know like if I want to change the currency in Oracle using sql statement?

How I could do that as when I use TO_CHAR (budget 'MYR99,999.00') not working but TO_CHAR (budget, '$99,999.00') it appears as $. I want in RM, so, I key in myr, not working.

Is there any solution that you like to share to solve this problem?

Upvotes: 0

Views: 1237

Answers (2)

thatjeffsmith
thatjeffsmith

Reputation: 22447

Using SQL Statement, then ALTER SESSION SET would suffice. If you want to change these settings for your sessions going forward in the tool, then you can do so in the preferences.

Configuring NLS Params in SQL Developer

Upvotes: 1

peter.hrasko.sk
peter.hrasko.sk

Reputation: 4141

You should first set up your locale, either on the DB-session level for your currency only ...

alter session set nls_iso_currency = 'MALAYSIA';

... or on the level of your client environment (Windows? Unix? whatever?) as the NLS_LANG environment variable ...

# on Unixes ...
export NLS_LANG=english_MALAYSIA.al32utf8

... and then you could use the correct format modifiers ...

select to_char(budget, 'fmC99G999D00', 'nls_numeric_characters=''.,''')
from dual;

Explanation of the format:

  • fm strips the leading spaces
  • C is for uppercase currency based on your locale
  • G is for the thousands grouping symbol
  • D is for the fractional part separator

Upvotes: 0

Related Questions