| NLS
Setting for Oracle Environment |
| Database
Level |
This way will effect all sessions that make the connection
to the database server |
| |
Add
the following lines in init.ora file :
NLS_LANGAUGE=THAI
NLS_TERRITORY=THAILAND |
| Environment
level |
This
way will effect only client that uses this environment |
|
|
Terminal
session
(Multi-user environment such as telnet)
In UNIX environment, set the environment variable
as follows:
In born, korn shell
$NLS_LANG=THAI_THAILAND.TH8TISASCII; export NLS_LANG
Win95/NT/2000 client
1. Run regedit, Registry window will appears
2. Select HKEY_LOCAL_MACHINE
3. Select SOFTWARE
4. Select ORACLE
5. Select NLS_LANG
Type the NLS_LANG and then enter the value THAI_THAILAND.TH8TISASCII
|
| Session
Level |
This
way will effect a current session only. |
| |
SQL>
alter session set NLS_LANGUAGE=THAI;
SQL> alter session set NLS_TERRITORY=THAILAND; |
| Thai
Sorting |
| |
You
can set a type of dictionary from environment level or session
level as follows:
Sample in born shell
$ NLS_SORT=THAI_DICTIONARY;export NLS_SORT |
| Thai
Buddha Calendar |
| |
You
can set a type of calendar from environment level or session
level as follows:
Sample in born shell
$ NLS_CALANDAR = 'Thai Buddha'
or
run 'regedit', set NLS_LANG=THAI_THAILAND.TH8TISASCII and
add NLS_CALENDAR = Thai Buddha |
| How
to check current database character set? |
| |
1.
Use SQL*Plus connect to database by using any user.
2. Enter the following SELECT command.
SQL> SELECT * FROM V$NLS_PARAMETERS;
or
SQL> select * from nls_database_parameters; |
| How
to check current environment value? |
| |
1.
Use SQL*Plus connect to database by using any user.
2. Enter the following SELECT command.
SQL> select * from nls_session_parameters; |
| How
to change database character set ? |
| Version
7.3.4 - by updating props% view |
| |
PROPS$
is an important view, it shows some NLS parameters.
Changing these parameters will effect with database NLS
parameters. Before changing it, please backup your database
first.
Warning: If
you do it wrongly, your database will be absalutely gone.
And you can't use this way in Oracle 8 and later version.
Steps to change
1. Use SQL*Plus connect to database as user SYS
2. Issue this below command
SQL> UPDATE PROPS$ SET VALUE$='TH8TISASCII' WHERE NAME='NLS_CHARACTERSET';
3. Shutdown database and restart it |
| 8.0.X
|
| |
For Oracle 8, there is ALTER DATABASE CHARACTER SET command
to change database character set. The "update props$"
cannot be used in this version.
|
|
8.1.X |
| |
For
Oracle 8i, there is ALTER DATABASE CHARACTER SET command
to change database character set. The "update props$"
cannot be used in this version.
You can change database character set by doing the following
steps. In this case SID name is fujudb.
Login
to oracle Database server as sys privilege
SQLPLUS> connect sys/change_on_install as sysdba;
SQLPLUS> shutdown immediate;
SQLPLUS> startup mount;
SQLPLUS> alter system enable restricted session;
SQLPLUS> alter system set job_queue_processes=0;
SQLPLUS> alter system set aq_tm_processes=0;
SQLPLUS> alter database open;
SQLPLUS> alter database fujudb character set TH8TISASCII;
SQLPLUS> alter database fujudb national character set
TH8TISASCII;
SQLPLUS> shutdown immediate;
SQLPLUS> startup;
|
|
.
Warning You can't change character set of the current
database that have number of bits greater than the new one.
For example,
US7ASCII -> WE8ISO8859P1 =>
Can
TH8TISASCII -> US7ASCII =>
Cannot
WE8ISO8859P1 -> TH8TISASCII =>
Cannot
TH8TISASCII -> WE8ISO8859P1 =>
Can
US7ASCII -> TH8TISASCII =>
Can |
| How
to force client not to convert character set? |
| |
set
ORA_NLS_CHARACTERSET_CONVERSION in environment level in
korn shell |
| |
$export
ORA_NLS_CHARACTERSET_CONVERSION=NO_CHARACTER_SET_CONVERSION |
| The
NLS_LANG parameter |
| |
The
NLS_LANG parameter has 3 components (language, territory,
and character set) in the form:
NLS_LANG = language_territory.charset
Each component controls the operation of a subset of NLS
features:
language
Specifies conventions such as the language used for Oracle
messages, sorting, day names, and month names.
territory
Specifies conventions such as the default date, monetary,
and numeric formats.
charset
Specifies the character set used by the client application.
For example, US7ASCII, WE8ISO8859P1, TH8TISASCII, or JA16EUC.
ref: Oracle9i Globalization Support Guide Release 1 (9.0.1)
Part Number A90236-02 |
| |
|