ORA-01861:文字与格式字符串不匹配 [英] ORA-01861: literal does not match format string

查看:1515
本文介绍了ORA-01861:文字与格式字符串不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI ALL

我在执行错误时遇到选择查询

HI ALL

I HAD A SELECT QUERY WHILE EXECUTING I AM GETTING THE ERROR AS

ORA-01861: literal does not match format string
01861. 00000 -  "literal does not match format string"
*Cause:    Literals in the input must be the same length as literals in
           the format string (with the exception of leading whitespace).  If the
           "FX" modifier has been toggled on, the literal must match exactly,
           with no extra whitespace.


这是我的代码,请提供您的建议.


Here is my code kindly provide your suggestions.

select cust_folio_no,count(cust_folio_no),com_ref_no,customer_name,
 product_name from d_trxn_perm where
 LOAD_MMYY IN (to_char(add_months(SYSDATE,-1),'mmyyyy'),to_char(add_months(SYSDATE,-2),'mmyyyy'),
 to_char(add_months(SYSDATE,-3),'mmyyyy'))AND settlement_Date IN (to_char(add_months(SYSDATE,-1),'mmyyyy'),to_char(add_months(SYSDATE,-2),'mmyyyy'),
 to_char(add_months(SYSDATE,-3),'mmyyyy')) and rownum < 100000 and rbi_reject_code IN ('01','11','02','12','03','13','04','14','05','15') and
 client_recon_status_code in ('F','F1')
 group BY COM_REF_NO ,CUST_FOLIO_NO,CUSTOMER_NAME,product_name HAVING COUNT(cust_folio_no) = 3



Rgds
Jagadeshkumar



Rgds
Jagadeshkumar

推荐答案

没有看到您的表定义,我们只能猜测...
Without seeing your table definition, we can only guess...
settlement_Date IN 
(to_char(add_months(SYSDATE,-1),'mmyyyy'),to_char(add_months(SYSDATE,-2),'mmyyyy'), to_char(add_months(SYSDATE,-3),'mmyyyy'))


我的猜测是:setting_Date是一个日期,不能与长度为六的字符串进行比较.

试试这个:


My guess is: settlement_Date is a date, which cannot be compared to a string of length six.

Try this:

to_char(settlement_Date,'mmyyyy')
-------
IN (to_char(add_months(SYSDATE,-1),'mmyyyy'),
    to_char(add_months(SYSDATE,-2),'mmyyyy'), 
    to_char(add_months(SYSDATE,-3),'mmyyyy'))



希望这会有所帮助,
巴勃罗.



Hope this helps,
Pablo.


这篇关于ORA-01861:文字与格式字符串不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆