Solved

to_date between oracle and teradata using oracle gateway

Posted on 2010-11-19
4
1,794 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
  • 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Oracle Apps Profiles option: A user profile is a set of shifting options that alter the way one runs an application. A value is set for each option under the user's profile when the Oracle application user logs on to any responsibility or changes…
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
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.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

816 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now