咱們在使用plsql時,有時會遇到數據庫跟plsql的編碼格式錯誤,會須要更改編碼格式sql
如下是解決方法數據庫
原文:http://blog.csdn.net/fmhui879/article/category/954622windows
1、pl/sql developer 中文字段顯示亂碼
緣由:由於數據庫的編號格式和pl /sql developer的編碼格式不統一形成的。session
2、查看和修改oracle數據庫字符集: oracle
select userenv('language') from dual;ui
查詢結果:編碼
SIMPLIFIED CHINESE_CHINA.AL32UTF8spa
--修改oracle數據庫字符集:(在SQL Plus中).net
sql> conn / as sysdba;rest
sql> shutdown immediate;
database closed.
database dismounted.
oracle instance shut down.
sql> startup mount;
oracle instance started.
total system global area 135337420 bytes
fixed size 452044 bytes
variable size 109051904 bytes
database buffers 25165824 bytes
redo buffers 667648 bytes
database mounted.
sql> alter system enable restricted session;
system altered.
sql> alter system set job_queue_processes=0;
system altered.
sql> alter system set aq_tm_processes=0;
system altered.
sql> alter database open;
database altered.
sql> alter database character set internal_use JA16SJIS;
sql> shutdown immediate;
sql> startup;
3、修改pl/sql developer 的編碼格式:
在windows中創 建一個名爲「NLS_LANG」的系統環境變量,設置其值爲「SIMPLIFIED CHINESE_CHINA.ZHS16GBK」,
而後從新啓動 pl/sql developer,這樣檢索出來的中文內容就不會是亂碼了。若是想轉換爲UTF8字符集,能夠賦予「NLS_LANG」爲 「AMERICAN_AMERICA.UTF8」,而後從新啓動 pl/sql developer。其它字符集設置同上