Solved

how do I resolve error ORA-01861 during query execution

Posted on 2011-09-26
3
1,017 Views
Last Modified: 2012-05-12
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
Comment
Question by:sikyala
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 334 total points
ID: 36601008
Change:
publication_date <= '1900-01-01'

to:
publication_date <= to_date('1900-01-01','YYYY-MM-DD')
0
 
LVL 76

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 334 total points
ID: 36601019
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
 

Assisted Solution

by:iaakov
iaakov earned 166 total points
ID: 36713165
Try

where trunc(publication_date) <= to_date('1900-01-01','yyyy-mm-dd')
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question