Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how do I resolve error ORA-01861 during query execution

Posted on 2011-09-26
3
Medium Priority
?
1,028 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 78

Accepted Solution

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

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

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 1336 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 664 total points
ID: 36713165
Try

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
Suggested Courses

877 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