Reputation: 481
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
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.
Upvotes: 1
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 spacesC
is for uppercase currency based on your localeG
is for the thousands grouping symbolD
is for the fractional part separatorUpvotes: 0