熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

關於Oracle客戶端顯示亂碼問題

2022-06-13   來源: Oracle 

  看下面演示與分析

  SQL> select * from nls_database_parameters;

  PARAMETER                      VALUE

  

  NLS_LANGUAGE                   AMERICAN

  NLS_TERRITORY                  AMERICA

  NLS_CURRENCY                   $

  NLS_ISO_CURRENCY               AMERICA

  NLS_NUMERIC_CHARACTERS        

  NLS_CHARACTERSET               ALUTF

  NLS_CALENDAR                   GREGORIAN

  NLS_DATE_FORMAT                DDMONRR

  NLS_DATE_LANGUAGE              AMERICAN

  NLS_SORT                       BINARY

  NLS_TIME_FORMAT                HHMISSXFF AM

  PARAMETER                      VALUE

  

  NLS_TIMESTAMP_FORMAT           DDMONRR HHMISSXFF AM

  NLS_TIME_TZ_FORMAT             HHMISSXFF AM TZR

  NLS_TIMESTAMP_TZ_FORMAT        DDMONRR HHMISSXFF AM TZR

  NLS_DUAL_CURRENCY              $

  NLS_COMP                       BINARY

  NLS_LENGTH_SEMANTICS           BYTE

  NLS_NCHAR_CONV_EXCP            FALSE

  NLS_NCHAR_CHARACTERSET         ALUTF

  NLS_RDBMS_VERSION             

   rows selected

  windows客戶機上

  H:\Users\LuoTaoyang>chcp

  活動代碼頁:

  H:\Users\LuoTaoyang>set NLS_LANG=American_AmericaZHSGBK

  SQL> DESC chartest;

  Name                                      Null?    Type

  

  ID                                                 NUMBER()

  NAME                                               VARCHAR()

  SQL> insert into chartest values(你好嗎ABC);

   row created

  SQL> SELECT * from chartest;

  ID NAME

  

   你好嗎ABC

  SQL> select iddump(name) from chartest;

  ID

  

  DUMP(NAME)

  

  

  Typ= Len= CharacterSet=ALUTF: ebdaeabde

  #你好嗎ABC在ZHSGBK字符集下進制代碼為 C E BA C C F 之所以跟Oracle存儲的不同時因為客戶端字符集(ZHSGBK)與Oracle主字符集(ALUTF)不同Oracle在底層發生字符集轉換的原因

  H:\Users\LuoTaoyang>set NLS_LANG=American_AmericaALUTF

  SQL> select * from chartest;

  ID NAME

  

   浣犲ソ鍚桝BC

  #出現亂碼是因為此時Oracle客戶端字符集與Oracle主字符集相同Oracle不發生字符集轉換但在windows下依然用字符集(ZHSGBK)顯示


From:http://tw.wingwit.com/Article/program/Oracle/201311/18495.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.