• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1030
  • Last Modified:

how do I resolve error ORA-01861 during query execution

When i execute the following query:

elect pdf_name, site, to_char(publication_date, 'YYYY-MM-DD') as publication_date,  modified_date, db_inserted,db_updated from bib_holdings where publication_date <= '1900-01-01';

I get the ORA-01861 error


It is not apparant to me how I am formatting my literal string the wrong way. can someone help me with this?
0
sikyala
Asked:
sikyala
  • 2
3 Solutions
 
slightwv (䄆 Netminder) Commented:
Change:
publication_date <= '1900-01-01'

to:
publication_date <= to_date('1900-01-01','YYYY-MM-DD')
0
 
slightwv (䄆 Netminder) Commented:
Try to never to implicit conversions.

When you need a 'string' use to_char.
When you need a date, use to_date.

Do not let Oracle 'guess' when you need a string turned into a date and what format it is in and visa-versa.
0
 
iaakovCommented:
Try

where trunc(publication_date) <= to_date('1900-01-01','yyyy-mm-dd')
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now