0

再会。

我正在执行查询并遇到:

ORA-01861 literal does not match format string error.

我执行了这个查询并且它工作了。

SELECT * FROM GCACC_OPERATION_DETAIL WHERE id_notice in (75078741) 
AND id_analytical_center in (100000002) 
AND interface_date = '2013-06-30' 
AND generic_client = 'someGenClient' 
AND document_class = 'DOCCLA0001' 
AND accounting_tag_identifier = 1 
AND generated_actual_acc_doc 
IN (select id_accounting_document 
from gcacc_accounting_document 
where document_status = 'DOCSTA0001');

我的另一个查询写在下面,它不起作用。

SELECT * FROM GCACC_OPERATION_DETAIL WHERE id_notice IN (75078741) 
AND id_analytical_center in (100000002) 
AND generic_client = 'someGenClient' 
AND document_class = 'DOCCLA0001' 
AND accounting_tag_identifier = 1 
AND interface_date = '2013-06-30' 
AND ind_pending_process = 1 
AND operation_type 
IN (select cod_develop from gcacc_operation_type where ind_operation = 'B');

这真的很奇怪,因为错误发生在日期部分,但我正在为日期部分编写相同的语法。我可能在这里错过了一些愚蠢的东西,需要更新鲜的眼睛。提前致谢!

4

1 回答 1

3

我不知道具体问题是什么,但假设“interface_date”是 DATE 类型,在查询日期时使用文字是不好的做法。这假设默认 NLS_DATE_FORMAT 与您的日期文字一致。那会回来咬你。为确保您的日期约束是可移植的,请更改为:

AND interface_date = to_date('2013-06-30','YYYY-MM-DD')
于 2013-02-27T02:49:39.620 回答