Solved

to_date between oracle and teradata using oracle gateway

Posted on 2010-11-19
4
1,806 Views
Last Modified: 2013-11-11
this column "Date_Pay" is CHAR(10) at teradata WH and it looks like this
'2010-10-18'


when I try this sql filter
AND cast(cl."Date_Pay" as date) BETWEEN TO_DATE ('2010/01/01',
                                                       'yyyy/mm/dd')
                                          AND  TO_DATE ('2010/01/02',
                                                        'yyyy/mm/dd')

I get error msg ORA-01861

literal does not match format string

Cause: Literals in the input must be the same length as literals in the format string (with the exception of leading whitespace). If the "FX" modifier has been toggled on, the literal must match exactly, with no extra whitespace.

Action: Correct the format string to match the literal.
0
Comment
Question by:it-rex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:Akenathon
ID: 34174006
Instead of CAST, try using TO_DATE on the field.

Try this: AND cast(cl."Date_Pay" as date) < sysdate

...and you'll see the to_dates you already have are not the cause of the problem.
0
 
LVL 11

Author Comment

by:it-rex
ID: 34174021
how can I use a between clasue,here?
0
 
LVL 11

Accepted Solution

by:
Akenathon earned 500 total points
ID: 34174040
You CAN use the between. That part is not wrong. The part which is wrong is the portion before the between

You need to convert your character field to a date. That is not done using CAST, it is done using to_date in this fashion:


AND TO_DATE(cl."Date_Pay", 'yyyy/mm/dd') BETWEEN TO_DATE ('2010/01/01',
                                                       'yyyy/mm/dd')
                                          AND  TO_DATE ('2010/01/02',
                                                        'yyyy/mm/dd')
0
 
LVL 11

Author Closing Comment

by:it-rex
ID: 34174080
thanks
0

Featured Post

Industry Leaders: 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

Salesforce.com is a cloud-based customer relationship management (CRM) system. In this article, you will learn how to add and map custom lead and contact fields to your Salesforce instance.
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
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.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

724 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