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!

How to Push/Pop NLS_LANGUAGE Session state

LPNOMay 18 2018 — edited May 24 2018

I have some data export scripts in a multilanguage environment. Our report generating SQL relies on customs views, each of which has it's own pile of dependencies of other views and tables. At the lower end of these dependencies reference goes to some OEBS views of our ERP software provider. Some of these are language dependend, like WIP_DISCRETE_JOBS_V that relies on the view MFG_LOOKUPS, that is filtered by LANGUAGE = USERENV ('LANG'). Thus as I can't tamper these views given by OEBS, I plan to change the session parameter NLS_LANGUAGE: At the start of the SQL-script NLS_LANGUAGE is set, normally defined by the login into the current session. I wan't to alter the NLS_LANGUAGE with

ALTER SESSION SET nls_language='AMERICAN';

..

ALTER SESSION SET nls_language='GERMAN';

..

ALTER SESSION SET nls_language='FRENCH';

..

ALTER SESSION SET nls_language='DUTCH';

such that language specific output is spooled correctly for diffrent languages in the same script. In the end of the script I' like to restore to the previous setting of NLS_LANGUAGE, to whatever this has been when entering the script. Aka, I like to do something like a push/pop operation for the session parameter. I there a simple and clever way to achieve this? Thanks, LPNO

This post has been answered by mathguy on May 18 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 21 2018
Added on May 18 2018
9 comments
2,321 views