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!

max(to_char(date,'DD-MM-YYYY')) ?

greddyNov 1 2006 — edited Nov 1 2006
Hi All,

SQL> desc hday;
Name Null? Type
------------------------- -------------- --------
H_DATE NOT NULL DATE

SQL> select max(h_date) from hday;

MAX(H_DATE
---------------
03-JAN-11

SQL> select max(to_char(h_date,'DD-MM-YY')) from hday;

MAX(TO_C
--------
31-12-99

SQL> select max(to_char(h_date,'DD-MON-YY')) from hday;

MAX(TO_CH
---------
31-MAY-99

My question is why am i getting different dates when i use different date formats in MAX function ?

any ideas ?
greddy
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 29 2006
Added on Nov 1 2006
4 comments
6,404 views