標籤:
在使用pl/sql developer時,查詢出來中文欄位顯示亂碼,因為資料庫的編號格式和pl /sql developer的編碼格式不統一造成的。
一、查看和修改oracle資料庫字元集
select userenv(‘language‘) from dual;--查詢結果:SIMPLIFIED CHINESE_CHINA.AL32UTF8--修改oracle資料庫字元集:(在SQL Plus中)sql> conn / as sysdba;sql> shutdown immediate;database closed.database dismounted.oracle instance shut down.sql> startup mount;oracle instance started.total system global area 135337420 bytesfixed size 452044 bytesvariable size 109051904 bytesdatabase buffers 25165824 bytesredo buffers 667648 bytesdatabase 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;
二、修改pl/sql developer 的編碼
在windows中創 建一個名為“NLS_LANG”的系統內容變數,設定其值為“SIMPLIFIED CHINESE_CHINA.ZHS16GBK”,然後重新啟動 pl/sql developer,這樣檢索出來的中文內容就不會是亂碼了。如果想轉換為UTF8字元集,可以賦予“NLS_LANG”為 “AMERICAN_AMERICA.UTF8”,然後重新啟動 pl/sql developer。其它字元集設定同上
Oracle和plsql developer編碼設定