说明数据库不支持中文,修改为GBK或者Utf-8就可以了。
ALTER SYSTEM DISABLE RESTRICTED SESSION;改完编码后执行
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 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 UTF-8;
sql> shutdown immediate;
sql> startup;
查看数据库编码格式:select userenv('language') from dual;
如果数据库格式支持中文,那么就要看下执行的sql是不是本身就有乱码了。
不加N?
insert into table
values(.....,N'中文',...)这种模式,而且列必须为nvarchar格式才能存储中文不乱码
用这个查询ORACLE的编码类型,看与你插入的是否一致
select * from nls_database_parameters where parameter ='NLS_CHARACTERSET';
数据库设置的编码有问题