Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can't get to_char on a date with NLS_LANGUAGE option to work

kendennyMar 11 2013 — edited Mar 11 2013
I'm working on developing an application that will be multi-lingual. I need to replace a bit of text in a string with a date in dd Month yyyy format. In order for the month to display in the user's selected language, I need to do a to_char using the NLS_LANGUAGE option but I can't seem to get it to work. No matter what language I use, I get the result in English.
SQL> select to_char(SYSDATE,'dd Month yyyy','NLS_LANGUAGE=GERMAN') FROM dual;
 
TO_CHAR(SYSDATE,'DDMONTHYYYY',
--------------------------------------------
11 March     2013
 
SQL> select to_char(SYSDATE,'dd Month yyyy','NLS_LANGUAGE=FRENCH') FROM dual;
 
TO_CHAR(SYSDATE,'DDMONTHYYYY',
--------------------------------------------
11 March     2013
 
SQL> select to_char(SYSDATE,'dd Month yyyy','NLS_LANGUAGE=ITALIAN') FROM dual;
 
TO_CHAR(SYSDATE,'DDMONTHYYYY',
--------------------------------------------
11 March     2013
I must have the syntax correct because if I use an invalid language I get an error.
SQL> select to_char(SYSDATE,'dd Month yyyy','NLS_LANGUAGE=XXX') FROM dual;
 
select to_char(SYSDATE,'dd Month yyyy','NLS_LANGUAGE=XXX') FROM dual
 
ORA-12702: invalid NLS parameter string used in SQL function
How do I get this to work correctly?
This post has been answered by Frank Kulash on Mar 11 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 8 2013
Added on Mar 11 2013
2 comments
12,189 views