Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

TO_CHAR & TO_DATE returning 2 different values

2942624Jan 9 2016 — edited Jan 10 2016

Hi,

I am trying to retrieve periodkey from my table. I get different result when I use to_char & to_date

SELECT MAX(TO_CHAR(PERIODKEY,'DD-MON-YY')) FROM TSEG5  --31-OCT-10

SELECT MAX(TO_DATE(PERIODKEY,'DD-MON-YY')) FROM TSEG5  -- 01-NOV-15

01-NOV-15 is the correct value. But I need to use to_char to convert. Please suggest how can I get correct value with to_char.

This post has been answered by Anton Scheffer on Jan 9 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 7 2016
Added on Jan 9 2016
20 comments
6,194 views