character encoding - difference between NLS_NCHAR_CHARACTERSET abd NLS_CHARACTERSET for Oracle -
i have quick question here, know difference between nls_nchar_characterset , nls_characterset setting in oracle ??
from understanding nls_nchar_characterset nvarchar data types , nls_characterset varchar2 data types.
i tried test on development server current settings characterset following :-
parameter value ------------------------------ ---------------------------------------- nls_nchar_characterset al16utf16 nls_numeric_characters ., nls_characterset us7ascii
then inserted chinese character values database. inserted characters table called data_ , updated column address , address_2 varchar2 columns. right understanding current setting nls_characterset us7ascii , chinese characters should not supported still showing in database ?? nls_nchar_characterset take precedence on ??
thank you.
in general points correct. nls_nchar_characterset
defines character set nvarchar2
, et. al. columns whereas nls_characterset
used varchar2
.
why possible see chinese characters
us7ascii
?
the reason is, database character set , client character set (i.e. see nls_lang
value) both us7ascii
. database uses us7ascii
, "thinks" client sends data using us7ascii
. not make conversion of strings, data transferred one-to-one client server , vice versa.
due fact can use characters not supported us7ascii
. aware, in case client uses different character set (e.g. when use odp.net managed driver in windows application) data rubbish! if consider database character set migration have same issue.
another note: don't think same behavior other character sets, e.g. if database , client both use we8iso8859p1
example. aware have wrong configuration. database uses character set us7ascii
, nls_lang
value us7ascii
(most not set @ , oracle defaults us7ascii
) real character set of sql*plus, resp. cmd.exe
terminal cp950 or cp936.
if set can either set environment variable nls_lang=.zht16mswin950
(cp936 seems not supported oracle) or change codepage before running sqlplus.exe
command chcp 437
. proper settings not see chinese characters have expected.
Comments
Post a Comment