Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a large set of files with SQL commands that I run with a SQL*Plus script that uses the @@ operator. I run the script on third-party computers (or even send it by e-mail) so I'd like to make it as self-contained as possible.

Files are encoded as Win-1252. Currently, I need to set the NLS_LANG environment variable before running the script:

C:\> SET NLS_LANG=SPANISH_SPAIN.WE8MSWIN1252

C:\> echo exit | sqlplus foo/bar@//example.com/xe @install.sql

This works but I wonder if it's possible to change the client encoding with a SQL or SQL*Plus command. (Or at least read the value and abort execution if it doesn't match.)

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

NLS_LANG can't be changed from inside a session, however other settings can.

You can't change the character set once a database connection has been established (ie: the 2nd part of NLS_LANG), but you can change the language with:

alter session set NLS_LANGUAGE=SPANISH

... and the territory with:

alter session set NLS_TERRITORY=SPAIN
share|improve this answer
    
Thank you. I just found SQL*Plus Globalization Support. –  Álvaro G. Vicario Mar 7 '13 at 13:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.