建立t_gtype表:
SQL> create table t_gtype(
2 gtid char(6) primary key,
3 gtname varchar2(20) not null
4 );
插入資料:
SQL> insert into t_gtype values('T00001','日常百貨');
查詢資料中文顯示亂碼:
SQL> select * from t_gtype;
GTID GTNAME
------ --------------------
T00001 ????????
查詢資料庫服務端字元集:
SQL> select * from v$nls_parameters;
NLS_DATE_LANGUAGE
SIMPLIFIED CHINESE
NLS_CHARACTERSE
ZHS16GBK
服務端字元集為中文字元集,猜測用戶端字元集問題,退出sql,設定用戶端字元集:
[oracle@apex ~]$ export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
進入sql,重新插入資料:
SQL> insert into t_gtype values ('T00002','兒童用品');
查詢資料顯示,更改用戶端字元集後插入的中文正常顯示,但之前插入的仍顯示為亂碼: