Solved

to_date between oracle and teradata using oracle gateway

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
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.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

739 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