Solved

how do I resolve error ORA-01861 during query execution

Posted on 2011-09-26
3
1,018 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 77

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 77

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
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.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

821 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