haki
haki

Reputation: 9779

setting NLS_LANG only for SQL*Plus

I have NLS_LANG set in the registry for my local language. The CMD is not able to display the characters of my local language so i see jibrish. i'm talking about prompts from the client and not actual data, error messages for example.

SQL> conn scott/tiger
ετσß°.

I need to keep the client's setting to the local NLS because other programs are dependent on it.

I've tried adding $set NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252 in the glogin but obviously it's not working since the script is executed only after sql*Plus had already been started.

My question is , is there any way of setting the NLS_LANG to AMERICAN_AMERICA.WE8MSWIN1252 only for SQL*Plus ?

Upvotes: 6

Views: 83948

Answers (5)

Stuart Smith
Stuart Smith

Reputation: 2051

This worked for me when I ran into the same issue today

From a windows command prompt run before running sqlplus

set NLS_LANG=.AL32UTF8

Upvotes: 0

Saddam ZEMMALI
Saddam ZEMMALI

Reputation: 11

set linesize 2000;
select * from NLS_DATABASE_PARAMETERS; 


SHUTDOWN IMMEDIATE;

STARTUP MOUNT;

ALTER SYSTEM ENABLE RESTRICTED SESSION;

ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;

ALTER SYSTEM SET AQ_TM_PROCESSES=0;

ALTER DATABASE OPEN;

ALTER DATABASE CHARACTER SET INTERNAL_USE  WE8MSWIN1252;
alter database national character set internal_use AL16UTF16;

SHUTDOWN IMMEDIATE; 
STARTUP;

Upvotes: -2

Ludovic Feltz
Ludovic Feltz

Reputation: 11916

NLS_LANG cannot be changed for the session in SQL*Plus. You can only set the langage, territory, numeric characters, etc ... For example:

ALTER SESSION SET NLS_LANGUAGE = 'AMERICAN';
ALTER SESSION SET NLS_NUMERIC_CHARACTERS = '.,';

NLS_LANG is set as an environment variable, so before running SqlPlus use:

On Windows:

set NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252

On Unix (Solaris and Linux, centos etc)

export NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252

Upvotes: 11

David Aldridge
David Aldridge

Reputation: 52396

You can use the login.sql or glogin.sql to run arbitrary commands when SQL*Plus starts, so set the appropriate session settings in there

Upvotes: 1

ErolCimen
ErolCimen

Reputation: 19

alter session set nls_language='AMERICAN';

will solve your problem...

Upvotes: 0

Related Questions