现在的位置: 首页 > 综合 > 正文

ORA-01861: 文字与格式字符串不匹配 报错处理

2018年02月07日 ⁄ 综合 ⁄ 共 737字 ⁄ 字号 评论关闭

创建下面的物化视图报错

create materialized view BBB
refresh complete on demand
as
select a.vbillcode,
b.invname,
del.exchdate
 from AA@AA  a
 inner join BB@BB b on a.id = b.id

left join CC@CC del on a.id = del.id 
 where a.dbilldae>='2013-06-15' and a.vdef7 is not null;

报错:

ORA-01861: 文字与格式字符串不匹配
ORA-02063: 紧接着 line (起自 TES)

分析:

通过执行物化视图的查询部分

select a.vbillcode,
b.invname,
del.exchdate
 from AA@AA  a
 inner join BB@BB b on a.id = b.id
left join CC@CC del on a.id = del.id 
 where a.dbilldae>='2013-06-15' and a.vdef7 is not null;

仍然报相同的错误,由于这个查询涉及到了四个数据库(三个远程,一个本地),感觉可能是环境不一致问题或者sql执行环境配置问题。

解决

通过在session中设置

alter session set nls_language='AMERICAN';

ALTER SESSION SET NLS_LANGUAGE='SIMPLIFIED CHINESE';

然后发起查询都没有解决问题,那设置一下时间格式试试:

alter session set nls_date_format='YYYY-MM-DD HH24:MI:SS';

执行查询sql成功,没有想到一个时间格式问题会导致语句无法执行,看来什么事情都是可能会发生的。

 

 

 

抱歉!评论已关闭.