Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
master_student
Creator III
Creator III

OraOLEDB, ErrorMsg: ORA-01861: literal does not match format string

Hello community,

I need to get the result of a query; Date today.

The date field format is 063016. here's my query :

SELECT ....

FROM

WHERE

tt.STARTOFCHARGINGDATE = TO_DATE (TO_CHAR (SYSDATE , 'MMDDYY'), 'MMDDYY')

It didn't work; Error : OraOLEDB, ErrorMsg: ORA-01861: literal does not match format string

Any idea please?

Thanks

1 Solution

Accepted Solutions
Gysbert_Wassenaar

STARTOFCHARGINGDATE is a varchar, i.e. text. Your comparing a text value with a date value. Perhaps this works:


SELECT ....

FROM

WHERE

tt.STARTOFCHARGINGDATE = TO_CHAR (SYSDATE , 'MMDDYY')


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
master_student
Creator III
Creator III
Author

for your info, the data type of the stratofcharging field is varchar. see bellow :

Capture.PNG

Thanks in advance.

Gysbert_Wassenaar

STARTOFCHARGINGDATE is a varchar, i.e. text. Your comparing a text value with a date value. Perhaps this works:


SELECT ....

FROM

WHERE

tt.STARTOFCHARGINGDATE = TO_CHAR (SYSDATE , 'MMDDYY')


talk is cheap, supply exceeds demand
ejvanmastrigt
Partner - Contributor II
Partner - Contributor II

TO_DATE() converts your string to a date.

Since the data type of STARTOFCHARGINGDATE is VARCHAR2, using function TO_CHAR should do it:

WHERE STARTOFCHARGINGDATE = TO_CHAR(SYSDATE, 'MMDDYY')

Best regards,

Erik